QCustomPlot Discussion and Comments

Why doesn't the compiler allow me to use the 'addPlottable' command?Return to overview

I would like to generate a QCPCurve by writing:

QCPCurve *test = new QCPCurve(ui->customPlot->xAxis, ui->customPlot->yAxis); 

However the autoFill doesn't provide me with the possibility to write the addPlottable command. The compiler therefore gives me
an error message:

'class MainWindow' has no member named 'addPlottable'

Can someone enlighten me what this means?

addPlottable isn't necessary anymore, that was from QCP version 1.0. Just leave it out and it works.

Okay. Thing is, if I want to add datapoints to the curve by writing

 QVector<double> x(1),y(1);
    x[0] = 1;
    y[0] = 2;

I get the error message:

'test' was not declared in this scope

Why do you think 'test' becomes a member of the QCustomPlot instance?
Try this instead:

QCPCurve *test = new QCPCurve(ui->customPlot->xAxis, ui->customPlot->yAxis);
test->setData({1, 2, 3, 2, 1}, {2, 0, 4, 8, 3});

Did you look at the demos using QCPCurve?

Awesome that made it, thank you!