i am trying to plot a simple curve:
QwtPlot *myPlot = new QwtPlot(QwtText("a Curves"),0);
// add curves
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
double x[100], y[100];
for (int i = 0; i < 100; i++)
{
x[i] = 2.777*i;
y[i] = 0.888*i;
}
// copy the data into the curves
curve1->setData(x,y,100);
curve1->attach(myPlot);
myPlot->replot();
and i get:
error: no matching function for call to ‘QwtPlotCurve::setData(double [100], double [100], int)’
/usr/local/qwt-6.0.0-rc5/include/qwt_plot_seriesitem.h:146: candidates are: void QwtPlotSeriesItem<T>::setData(QwtSeriesData<T>*) [with T = QPointF]
what should i do?
Added after 48 minutes:
The "setRawSamples" worked!
Does anyone know what is the proper usage of setData for this example?!
double * x1;
double * y1;
x1 = new double [100];
y1 = new double [100];
// double x1[100], y1[100];
for (int i = 0; i < 100; i++)
{
x1[i] = 2.777*i;
y1[i] = 0.888/(i+1);
}
// copy the data into the curves
curve1->setRawSamples(x1,y1,5);
curve1->attach(myPlot);
myPlot->replot();
Bookmarks