Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Delete datas from chart series, after adding them on a chart

Delete datas from chart series, after adding them on a chart

Scheduled Pinned Locked Moved Unsolved General and Desktop
chartseriesqt5
5 Posts 3 Posters 955 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deleted286
    wrote on 7 Jan 2021, 11:17 last edited by
    #1

    In the code script, i got datas from queue and add them into chart via series. Let say we have 10 data. When im adding the 6.data, i want to delete the first one. So, for showing new items on a chart, i should delete the old ones. How can i do such thing?

    static float q_x;
      if(!queue.isEmpty())
       {
          double num=queue.dequeue();
          q_x += 0.1;
          series->append(q_x, num);
          chart->update();
          qDebug() << q_x << num;
        }
    
    J 1 Reply Last reply 7 Jan 2021, 12:33
    0
    • D deleted286
      7 Jan 2021, 11:17

      In the code script, i got datas from queue and add them into chart via series. Let say we have 10 data. When im adding the 6.data, i want to delete the first one. So, for showing new items on a chart, i should delete the old ones. How can i do such thing?

      static float q_x;
        if(!queue.isEmpty())
         {
            double num=queue.dequeue();
            q_x += 0.1;
            series->append(q_x, num);
            chart->update();
            qDebug() << q_x << num;
          }
      
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 7 Jan 2021, 12:33 last edited by
      #2

      @suslucoder There are several remove(...) methods in https://doc.qt.io/qt-5/qxyseries.html
      Did you check that?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply 7 Jan 2021, 13:14
      3
      • J jsulm
        7 Jan 2021, 12:33

        @suslucoder There are several remove(...) methods in https://doc.qt.io/qt-5/qxyseries.html
        Did you check that?

        D Offline
        D Offline
        deleted286
        wrote on 7 Jan 2021, 13:14 last edited by
        #3

        @jsulm yes, i've checked them. I tried chart->series().removeFirst();

        But i cant decide where should it placed?
        It shoud remove after updating the chart with a new data, but when i placed it after chart->update, there are no lines in chart. I couldnt understand

        J 1 Reply Last reply 7 Jan 2021, 13:17
        0
        • D deleted286
          7 Jan 2021, 13:14

          @jsulm yes, i've checked them. I tried chart->series().removeFirst();

          But i cant decide where should it placed?
          It shoud remove after updating the chart with a new data, but when i placed it after chart->update, there are no lines in chart. I couldnt understand

          J Offline
          J Offline
          JonB
          wrote on 7 Jan 2021, 13:17 last edited by
          #4

          @suslucoder
          Since your code only appends one point at a time, if you remove one point in the same place it will go empty.

          If you want to do something about

          When im adding the 6.data, i want to delete the first one.

          you need to write code to do that.

          D 1 Reply Last reply 7 Jan 2021, 13:29
          1
          • J JonB
            7 Jan 2021, 13:17

            @suslucoder
            Since your code only appends one point at a time, if you remove one point in the same place it will go empty.

            If you want to do something about

            When im adding the 6.data, i want to delete the first one.

            you need to write code to do that.

            D Offline
            D Offline
            deleted286
            wrote on 7 Jan 2021, 13:29 last edited by
            #5

            @JonB Hmmmm, i got. actually what i want to do is scrolling my chart. I have about 20 point, and i cant see all of them on the secreen. It shows just up to the size of the axis, and the others cant seen on the secreen. Ekran görüntüsü 2021-01-06 171507.png
            There are too many datas on the right but we cannot see.

            1 Reply Last reply
            0

            5/5

            7 Jan 2021, 13:29

            • Login

            • Login or register to search.
            5 out of 5
            • First post
              5/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved