Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to plot a graph in Qt without using QWT
i want to draw an X-Y plot using Qt libraries..
can anyone tell me how can i acheive this...
i know that it can be done using QWT, but want to do it in Qt..
please help me..
thanx in advance...
lgeyer last edited by
Create your own widget by subclassing QWidget and reimplementing painEvent().
I strongly recommend that you take a look at the "examples":http://developer.qt.nokia.com/doc/qt-4.8/widgets-analogclock.html or a "book":http://www.qtrac.eu/marksummerfield.html first.
now when i draw my XY plot, then its gonna have x-axis and y-axis...
now when it want to plot apoint in the graph, then the point is not coming exactly on the graph, its due the fact that they are being drawn on the scale coordinates so what can i do to make it work properly..
lgeyer last edited by
Did you transform the painter in any way? Are you using widget local coordinates? Have you considered any border you have drawn?
C++ GUI Programming with Qt 4 (First Edition), which is available for free at the link found in my previous post, has a chapter about custom widgets using the example of a plot widget, which supports zooming and scaling.
@lukas thank u..
i will try that and get back to u..
I also want to plot graphs, but I don't want to make a new program because there are already good ones and I don't have the level to make something better.
The approach I will probably take is using "SciDAVis":http://scidavis.sourceforge.net/, which is written in Qt and has a plugin interface.
I let you know this in case it's useful, but I suppose you want to write your own.
@ david_gil thanx..
i downloaded the link u gave and i was reading the installation instructions, and it is saying that before installing it i must hve python installed on my machine...
and i am not havin python installed, also i dont want to install it...
i wanna do it without using python...
how can i do this...
Sorry, I thought it was a good idea, but I've seen that SciDAVis plugin capabilities can be found only in the bleeding edge version (0.3.0). Here you can see "that version's classes":http://scidavis.sourceforge.net/contributing/API/unstable/classes.html.
Perhaps you still find it interesting: http://www.workslikeclockwork.com/index.php/components/qt-plotting-widget/
It isn't QWT and seems very customizable.
Wilk last edited by
Do you have any reasons for not to use Qwt?
andre last edited by
Mosaic also "has some plotting components":http://www.mosaicsoftware.net/products/qt/ you might be interested in.