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

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 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.

    Joel BodenmannJ 1 Reply Last reply
    0
    • H HTWAMD

      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.

      Joel BodenmannJ Offline
      Joel BodenmannJ Offline
      Joel Bodenmann
      wrote on 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
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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 last edited by
          #4

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

          Joel BodenmannJ 1 Reply Last reply
          0
          • H HTWAMD

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

            Joel BodenmannJ Offline
            Joel BodenmannJ Offline
            Joel Bodenmann
            wrote on 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

            • Login

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