hi
I am charu, totally New to Qwt , i have to plot from .txt file containing floating point. i want to know how to load/read a datafile and plot it row by row (that is: one value by one)
thank you for ur grt help
hi
I am charu, totally New to Qwt , i have to plot from .txt file containing floating point. i want to know how to load/read a datafile and plot it row by row (that is: one value by one)
thank you for ur grt help
Hi charu,
I also new. I wrote something similar to load data from text file:
Qt Code:
return; QStringList list; while (!in.atEnd()) { list << in.readLine(); } data = new double[list.size()]; for(int i = 0; i< list.size(); i++){ data[i] = list[i].toDouble(); } dataSize = list.size();To copy to clipboard, switch view to plain text mode
And the data.txt in this format:
For plotting, you can look at the examples (simple plot maybe).1.8600000e+03
1.8640000e+03
1.8660000e+03
1.8550000e+03
1.8660000e+03
1.8760000e+03
Good luck.
Hüseyin
charu (23rd March 2009)
thank you so much
Now i need to Plot the data ?
can u plz tell me how to plot? I am using QT3 and QWT5.1.1
Sorry, I don't have Qt3.
Also I don't know the difference between 3 and 4.
Maybe both are same for simple things.
For plotting I am using double array, and QwtPlotCurve::setRawData() in a derived QwtPlot class.
You can also use setData().
Simply like this: (From QwtPlot Class Reference)
Qt Code:
#include <qwt_plot.h> #include <qwt_plot_curve.h> QwtPlot *myPlot; double x[100], y1[100], y2[100]; // x and y values // add curves getSomeValues(x, y1, y2); // copy the data into the curves curve1->setData(x, y1, 100); curve2->setData(x, y2, 100); curve1->attach(myPlot); curve2->attach(myPlot); // finally, refresh the plot myPlot->replot();To copy to clipboard, switch view to plain text mode
In getSomeValues(x, y1, y2) simply copy the data to the double buffers.
Hüseyin
thanks
i have error:expected constructor,destructor, or type conversion before'=' token..... hence i commented each line by line
1) no errors with include file alone
2) error started from myplot=... onwards .
i dont have any idea to solve this can you plz let me know what could be the problem on my program.
procedure i created the project:
1) New Project
2) New Widget
3) New main.cpp
copied ur code in the form1.ui.h and qmake, make ....errors plz help me
thank u in advance
thanks i got it
After incliding the lib file i can plot.
but the getSomeValues(); is not working, so i generated some x,y values and ploted
thank you so much 4r ur grt help
Bookmarks