[SOLVED]QWT plot doesn’t like my array
-
I try to use the QWt plot graph and I tried a little example.
But it crashes in the@curve1->setData(x,y1,100);@
//Error msg
error: no matching function for call to ‘QwtPlotCurve::setData(double [100], double [100], int)’My code
@ ui->qwtPlot->setTitle("TWO CURVES");
ui->qwtPlot->setParent(ui->tab_4);double x[100], y1[100]; for (int i = 0; i < 100; i++) { x[i] = i; y1[i] = 10-0.1*i*i; }
// add curves
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");// copy the data into the curves
curve1->setData(x,y1,100);
curve1->attach(ui->qwtPlot);ui->qwtPlot->replot();
@Anyone
-
Your application doesn't crash, your code raises a compilation error. Most probably because there is no such method setData() which takes two double arrays and an int as a parameter. Take another look at the "documentation":http://qwt.sourceforge.net/class_qwt_plot_series_item.html#adba072515f7c71c923985882129878c4.
-
"Here":http://programmingexamples.net/wiki/Qt/QWT/Plot is a simple but complete example.