This code
QCPBars *amp=new QCPBars(ui->hist->xAxis,ui->hist->yAxis); ....... amp->setData(x,y); hist->replot(); hist->update();
only adds new data to the histogram and doesn't clear old data. Moreover, I call this method every time new data is needed.
How to clear the histogram every time?
hist->clearGraphs(); doesn't work