QCustomPlot Discussion and Comments

Update graph without replot customplotReturn to overview

Hello everyone,

I am doing a software that is plotting multiple curves following the parameters of a config file. It means the user is setting the number of curves he's going to plot, the color of each curve, all axes range, ...

When I have my window with 1 QCustomPlot containing several QCPGraph I want to give the user the possibility to change the color of a curve or the valueAxis maximum for example.

I did a small test with a push button that looks like this :

void graphWidget::on_pushButton_clicked()
{
    // I have QCustomPlot *plt;  in my .h file
    plt->graph(0)->setPen(QPen(Qt::black,0,Qt::SolidLine));

    plt->graph(0)->valueAxis()->setRange(0,60);

    plt->replot();  // Works and apply the modification but it replots EVERYTHING and it can be quite long
}

However, I am dealing with really huge data files (often more than 10 millions lines with 4 to 6 collumns) so the plotting can take a few minutes.
The problem of calling replot on my QCustomPlot is that I replot everything, even the graph that have not been modified.

I'm looking for a solution to replot / update / redraw only the graph and/or the axes I modified
In my exemple above, I want to update graph(0) only and not replot graph(1), graph(2), their rectangle, their rectangles, their label, ....

Does anyone has a solution please ?
Thanks in advance

you can set different layer, see docs setLayer

Thanks, I found a way to replot precise element with the layers

try this

plt->replot(QCustomPlot::rpQueuedReplot);