QCustomPlot Discussion and Comments

Setting the title of customplotReturn to overview

Hi..I am doing real time plotting using qcustomplot..I am having multiple qcustomplot widgets..Now my problem is i have to set the title of the plot..The title has to be update real time..i.e.,the title should contain the changing y-axis value as time progresses..I tried using:

QString title;

cplot[inx]->plotLayout()->insertRow(0);
cplot[inx]->plotLayout()->addElement(0, 0, new QCPPlotTitle(cplot[inx],title));


Here title would be varying with time..but the title is not getting updated with time with the above code..how to solve this?thank you..


You shouldn't call the code you mention repeatedly, as this will keep replacing the title object which is unnecessary. Call the code just once, keep a pointer to the title and set the plot title with yourTitle->setText() repeatedly. After that, you should make sure it's replotted (customPlot->replot()), so the change becomes visible to the user.