I use QCustomPlot to display histograms of pictures. The function I use to set the a curve is the following:
void SingleHistogram::setHist(const QVector<double> &x,
const QVector<double> &y)
{
//clearGraphs();
graph(0)->setData(x, y);
graph(0)->rescaleAxes(true);
replot();
}
It works great for the first picture I open:
But when I set a new histogram using the same function, the first curve is not removed (even if setData()
calls clearData()
method of the graph) :
As you can seen the second curve (the peak) is added to the graph.
I'd like not to delete and reconstruct a new QCPGraph
for efficiency since I feel like it is useless.
Could someone tell me what I am doing wrong here?
Thanks!