[Solved]More qwt plot questions
-
wrote on 28 Nov 2011, 15:01 last edited by
In the documentation of QWT plot there is a code like this
@#include "../include/qwt_plot.h>
QwtPlot *myPlot;
long curve1, curve2; // keys
double x[100], y1[100], y2[100]; // x and y valuesmyPlot = new QwtPlot("Two Graphs", parent, name);
// add curves
curve1 = myPlot->insertCurve("Graph 1");
curve2 = myPlot->insertCurve("Graph 2");getSomeValues(x, y1, y2);
// copy the data into the curves
myPlot->setCurveData(curve1, x, y1, 100);
myPlot->setCurveData(curve2, x, y2, 100);// finally, refresh the plot
myPlot->replot();
@But when I try to use this methods setCurveData and insertCurve the compiler says
error: ‘class QwtPlot’ has no member named ‘insertCurve’ etc.And the documentation is upto date I think.
The other QWT widgets works and got there members but not this.
is it a old doc on the net or;
-
wrote on 28 Nov 2011, 15:13 last edited by
I have downloaded qwt-6.0.1 as a zip file less than a week ago. It is fairly small (<4MB). It contains in the doc directory an html documentation. The files have been generated on August 1, 2011. I assume that this the most recent documentation available. At least it refers to the compatibility of qwt 6.x on the main page.
-
wrote on 28 Nov 2011, 15:17 last edited by
This seems to be the same documentation on the "web ":http://qwt.sourceforge.net/index.html
-
wrote on 28 Nov 2011, 16:10 last edited by
Did you look in Qwt's headers files for setCurveData and insertCurve?
-
wrote on 28 Nov 2011, 16:30 last edited by
Well, QwtPlot neither has a setCurveData or a insertCurve member nor does its documentation have an example like the one you've listed above. You're most probably mixing 5.x libraries with 6.x documentation and vice versa. They are not compatible.
-
wrote on 28 Nov 2011, 20:56 last edited by
There was never such methods. Try something like this:
@
QwtPlot *myPlot = new QwtPlot("Two Graphs");
QwtPlotCurve *curve1 = new QwtPlotCurve("Graph 1");
QwtPlotCurve *curve2 = new QwtPlotCurve("Graph 2");//set curve color
curve1->setPen(QPen(Qt::green, 2));
curve1->setPen(QPen(Qt::red, 2));// add curves
curve1->attach(myPlot);
curve2->attach(myPlot);const int MAX_VALUES = 100;
double x[MAX_VALUES], y1[MAX_VALUES], y2[MAX_VALUES];// x and y values
getSomeValues(x, y1, y2);// copy the data into the curves
curve1->setRawSamples(x, y1, MAX_VALUES);
curve1->setRawSamples(x, y2, MAX_VALUES);// finally, refresh the plot
myPlot->replot();
@
it's untestet...
And of course take a look at very well examples in the qwt source. -
wrote on 29 Nov 2011, 07:04 last edited by
Yes this looks like my old function.
Thank you
1/7