QCustomPlot Discussion and Comments

How to remove old data points?Return to overview
October 2, 2016, 09:11
by Nyaruko

In the past we have the removeData and removeDataBefore functions. But it seems gone in the new version.
So How can we remove the old data points from a graph to prevent memory overflow?

October 2, 2016, 14:20
by wayland

look in the changelog, there is the new data interface with graph ->data() ->remove...

June 22, 2017, 23:26
by oaeide

I am also missing this feature. There is nothing called graph ->data() ->remove

June 22, 2017, 23:37
by oaeide

Sorry! I was trying to access
plot ->graph(0)->data() ->clear();
instead of
plot ->graph(i)->data() .data() ->clear();

Thanks for the quick reply

June 23, 2017, 08:18
by DerManu

But your first line is also correct, due to the -> operator of QSharedPointer:
http://doc.qt.io/qt-4.8/qsharedpointer.html#operator--gt

You don't need to explicitly call .data() on QSharedPointer, you can directly use

plot->graph(0)->data()->clear(); 

June 26, 2023, 16:21
by bigbaby

no no no,I test and find that

plot->graph(i)->data().data()->clear();
is work,but
plot->graph(0)->data()->clear();
do not work

June 26, 2023, 16:23
by bigbaby

Has anyone found a better way to solve the problem of excessive data leading to continuous memory growth? Or is it allowed to write the previous data to the disk?

AltStyle によって変換されたページ (->オリジナル) /