QCustomPlot Discussion and Comments

Graph indexing out of boundsReturn to overview

I have 4 graphs each one on a widget and I'm trying to plot on each one using this code block:

customPlot(i)->graph(0)->setData(x,y);
            customPlot(i)->graph(0)->setLineStyle(QCPGraph::lsNone);
            customPlot(i)->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 4));
            customPlot(i)->xAxis->setRange(XMin(X[j][i]),XMax(X[j][i]));
            customPlot(i)->yAxis->setRange(YMin(Y[j][i]),YMax(Y[j][i]));
            customPlot(i)->replot();

and I'm getting as an output: QCPGraph* QCustomPlot::graph(int) const index out of bounds: 0
I've ran the same code block on other projects and it worked fine and knowing that I have just one graph on each widget(promoted to qcustomplot) the index must be 0 correct me if I'm wrong

I found what my code has been missing...
In the part where I set my graphs I forgot the addGraph function which was a pretty dummy mistake