Plot a Graph with Real Time Data
I want to draw (plot) a graph in Qt creator with the real time data
Is there any special procedure to draw a graph?
can any one help me.
Thanks in advance
For plotting, you need a 3rd-party library because Qt doesn't have its own plotting functions. Have a look at "Qwt":http://qwt.sourceforge.net/
Someone else talked about his experiences here: http://technofreak-robotics.blogspot.com.au/2011/07/real-time-graph-plotting-in-gui-with-qt.html
By the way, "Qt Creator" is the name of the "IDE":http://en.wikipedia.org/wiki/Integrated_development_environment; "Qt" is the name of the software library.
thanks for the reply.
I found that QCustomPlot is also used to plot graphs. what is the difference between these two?
raven-worx Moderators last edited by
QCustomPlot is also a 3rd party solution and not part of the official Qt release.
[quote author="Swinetha" date="1372232893"]thanks for the reply.
I found that QCustomPlot is also used to plot graphs. what is the difference between these two?[/quote]You're welcome. You'll have to ask someone who has used both Qwt and QCustomPlot before though -- I have never used them.
Try reading their documentation to see what's different.
At first Itried to install qwt in my system.
its work fine.
but it's giving an error
bq. cd src/ && ( test -e Makefile || /usr/local/Qt-5.0.2/bin/qmake /usr/local/qwt-6.1.0/src/src.pro -o Makefile ) && gmake -f Makefile
Project ERROR: Unknown module(s) in QT: opengl
gmake: *** [sub-src-make_first-ordered] Error 3
any body know about this error?
if knows please help me.
Yout Qt version had been built without the opengl module. If you want to use an OpenGL plot canvas you need to rebuild Qt with this module - but usually you are not intersted in this feature and you can simply disable this feature for Qwt: edit qwtconfig.pri.
hi, thanks for the reply. opengl means?
to use this is there any procedure?
you said that,
bq. you can simply disable this feature for Qwt: edit qwtconfig.pri.
How can I disable it? could you explain me please
QCustomPlot doesn't require installing. The simplest mode of operation is to just include the qcustomplot.h and qcustomplot.cpp file, that's it.
Of course, you can also compile a dynamic library from it, if you'd like.
Have a look at the "QCustomPlot webpage":http://www.workslikeclockwork.com/index.php/components/qt-plotting-widget/ It offers an introductory tutorial that should get you started quickly.
A new website is in progress with much more support material.
DerManu said that
bq. The simplest mode of operation is to just include the qcustomplot.h and qcustomplot.cpp file, that’s it.
From where can I add these files?
Thanks in advance
[quote author="Swinetha" date="1372586436"]DerManu said thatFrom where can I add these files?[/quote]
Just download the QCustomPlot.tar.gz package from the download section (at the bottom of the page). In there, you'll find the .h/.cpp files. Copy them to your local project directory, and add them to your project. In QtCreator, right click on the root project icon in the top left sidebar, select "Add Existing Files..." to do that.
Then just #include "qcustomplot.h" wherever you need it (e.g. in your mainwindow.h).
Have a look at the webpage, it's pretty well explained there. The examples project should also help alot in getting started (that's also in the download package).
Compile Qwt :
Create visual studio project and copy only the header files and cpp files to the project and just compile. You can get the Qtw dll and libs.
QCustomPlot : does not have that much performance when it comes to adding real time data.
graph will lag after adding 100k points and will lag even more when few series are overlapped.
i think Qwt is much better choice than QCustomPlot,, but lack documentation is big issue. They have few doxygen generated documents, but they will be of little help.
mrjj Lifetime Qt Champion last edited by
Hi and welcome
The mailing list is pretty good source for help combined with the samples.
Although this post is rather old, here's my two cents: