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. Problem with QLineSeries
Forum Update on Monday, May 27th 2025

Problem with QLineSeries

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.7k 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.
  • H Offline
    H Offline
    HTWAMD
    wrote on 21 Jun 2016, 19:28 last edited by
    #1

    Hey,

    I have a variable of the type QLineSeries. I add every second a new value and I want to keep not more than 10 values at the same time.
    That means, if I insert value number 11, the first value has to be removed, the second value is the new first, third is now second, ...
    Can anyone help me? I tried to use removePoints() or remove() but without success.

    J 1 Reply Last reply 21 Jun 2016, 21:06
    0
    • H HTWAMD
      21 Jun 2016, 19:28

      Hey,

      I have a variable of the type QLineSeries. I add every second a new value and I want to keep not more than 10 values at the same time.
      That means, if I insert value number 11, the first value has to be removed, the second value is the new first, third is now second, ...
      Can anyone help me? I tried to use removePoints() or remove() but without success.

      J Offline
      J Offline
      Joel Bodenmann
      wrote on 21 Jun 2016, 21:06 last edited by Joel Bodenmann
      #2

      I have never used QLineSeries or any of the related classes but as nobody has replied yet I'll just go ahead and write down my thoughts...

      Looking at the documentation there doesn't seem to be any method that implements the behavior that you are describing. Hence you'll have to do it yourself.
      May I ask what exactly the problem was that you faced? It should only be a matter of correctly using QXYSeries::replace() in a for() loop.

      Industrial process automation software: https://simulton.com
      Embedded Graphics & GUI library: https://ugfx.io

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 21 Jun 2016, 21:38 last edited by
        #3

        Hi,

        A possible faster way might be to retrieve the vector of points using pointsVector, pop the first item, append the new one and the call the replace overload with the version of the vector.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • H Offline
          H Offline
          HTWAMD
          wrote on 22 Jun 2016, 09:17 last edited by
          #4

          Using pointsVector was a good hint! Thanks for the help!

          J 1 Reply Last reply 22 Jun 2016, 09:31
          0
          • H HTWAMD
            22 Jun 2016, 09:17

            Using pointsVector was a good hint! Thanks for the help!

            J Offline
            J Offline
            Joel Bodenmann
            wrote on 22 Jun 2016, 09:31 last edited by
            #5

            Can you please mark this topic as solved if you feel that your question has been answered?
            Guide for that: https://forum.qt.io/topic/62700/hitchhiker-s-visual-guide-to-the-qt-forum

            Industrial process automation software: https://simulton.com
            Embedded Graphics & GUI library: https://ugfx.io

            1 Reply Last reply
            0

            1/5

            21 Jun 2016, 19:28

            • Login

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