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?
There is.
http://www.qcustomplot.com/documentation/classQCPDataContainer.html#aa7f74cbce304b0369e1626c3798e1eda
http://www.qcustomplot.com/documentation/classQCPDataContainer.html#abbe5d87ffc10b5aeffa5bb42cf03aa3c
http://www.qcustomplot.com/documentation/classQCPDataContainer.html#ae5f569a120648b167efa78835f12fd38
http://www.qcustomplot.com/documentation/classQCPDataContainer.html#a2dbded7f0732bacf9db48fdfbbb620bc
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();
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
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?