Problem with QLineSeries
-
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. -
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 usingQXYSeries::replace()
in afor()
loop. -
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.
-
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