PDA

View Full Version : Plot Points from QwtPointArrayData with color according to Y Achsis



tklemmer
9th November 2011, 11:38
Hello

I have a series of dataset that I'm trying to plot, which works just fine.

Code looks kinda like this:


QwtPointArrayData *zing;
zing = new QwtPointArrayData(x,y);

QwtPlotCurve plotdata;
plotdata.setStyle( QwtPlotCurve::Dots );
plotdata.setData(zing);

plotdata.attach(qwtPlot);
qwtPlot->replot();

works just fine...

Now I'm trying to give the Points a Different Colors according to ther Y Values but have no clue how?!

How could this be done?

thanks
Tk

Uwe
9th November 2011, 13:53
Use QwtPlotSpectroCurve and implement your own type of QwtSeriesData<QwtPoint3D> object, where you store your 2D point array only, but calculate the z value from the y value inside of YourData::sample().

Uwe