QCustomPlot Discussion and Comments

How to add graph on a specific QCP Layer?Return to overview

The documentation is really abstract. From what I could make out is. I want to know if this understanding is valid?
1. If there are multiple QCPLayer then each QCPLayer should have its own graph(here in my case).
2. Only then if asked to replot this would layer would re-render.

/Add QCP Layer for historical data
    ui->chartPlot->addLayer("historical",ui->chartPlot->layer("grid"), QCustomPlot::limAbove);
    ui->chartPlot->layer("historical")->setMode(QCPLayer::lmBuffered);

If above is true then how to add a graph to this layer?

//This doesnt complie.
ui->chartPlot->layer('historical')->addGraph();

So how do I add a graph to a specific layer?

Use setCurrentLayer to set the current layer and then add the chart. This would add the graph/chart in the respective layer.