QCustomPlot Discussion and Comments


I have graph and has 3 lines. there was creating before. I want to clear all data when I push the button. (These data ploting from slots.) I use two method ;


But these code blocks delete all graph info. I want to delete only data in QCustom. How can I figure out this?

Thank you.

Like graph->clearData() ?

Make sure to replot after the delete.

Yes I m sure replot. Trow exeption there is no such a graph

Learn a bit more C++ , books or tutorials online. :)

If i understand correctly you want to hide(clear) those 3 lines so this should do it:
void QCPLayerable::setVisible ( bool on)


You will still be able to access data from graph data container.

QCustomplot takes control of the data pointers that you pass in. if you clear the graph, it will delete the data that the pointer points to. your options are to use a different set data method(one with a deep copy), or to modify the setData method so that you have an option to not delete the data previously there, and then set an empty data for it to take control of.

I dont want to change visibility. I want to open new qcustom plot after using.

If you know so much can you give me a sample code example Isso?

If Anyone wants to answer;
I write this code and problem solved.
For more details---> https://forum.qt.io/topic/75712/qcustomplot-clear-data/8


Now I see the confusion: graph->clearData() was removed in 2.0.0 and is now with the new data interface graph->data()->clear();

now its graph(0)->data().data().clear();

for( int g=0; g<pq_plot->graphCount(); g++ )