qwt several curves at a plot
I have a problem using the member function attach several times. I have attached many curves, than I make replot. As a result, only last attached curve is visible. Compiler does not find any errors. Here is my member function which draws several characteristics stored in ps_x and ps_y sequentially in the single column. The number of characteristics equals number_of_characteristics. I use qwt 6. version.
Code:
void DataPlot::plot_Draw(double ps_x[], double ps_y[], double x_min, double x_max, double y_min, double y_max, int number_of_characteristics)
{
double psx[1500];
double psy[1500];
setAxisScale
(QwtPlot::xBottom, x_min, x_max
);
setAxisScale
(QwtPlot::yLeft, y_min, y_max
);
for (int j=0;j<number_of_characteristics;j++){
d_curves
[j
]->setRenderHint
(QwtPlotItem::RenderAntialiased);
for (int j1=0;j1<1500;j1++){
psx[j1]=ps_x[j1+j*1500];
psy[j1]=ps_y[j1+j*1500];
};
// Insert new curves
d_curves[j]->setRawSamples(psx,psy,1500);
d_curves[j]->attach(this);
};
replot();
}
Re: qwt several curves at a plot
Probably this, from docs on QwtPlotCurve::attach
Quote:
Attach the item to a plot.
This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if necessary). If a NULL argument is passed, it will detach from any QwtPlot it was attached to.
Re: qwt several curves at a plot
Use setSamples instead of setRawSamples.
Uwe
Re: qwt several curves at a plot
Thank you Uwe! setSemples works perfect in my case.
What is difference between these functions? Where can I find tutorial for qwt 6.0. ?
Re: qwt several curves at a plot
Quote:
Originally Posted by
freude3
Yes, but how does in this case can the demo "sinusplot" works?
The bad code assigns memory from the stack without copying it. What has this to do with the sinusplot example - that uses a synthetic data class without storing arrays at all.
Uwe