PDA

View Full Version : Plotting graphs in Qt



Computer Hater
4th October 2011, 18:28
Hi,
I want to plot graphs in my program to display the results of a calculation.
I've been trying regular QGraphicsView functionality, but have been having difficulties getting it to work.
So far I've been ignoring this 'Qwt' label that has its own forum segment, but from what I'm reading now it seems that Qwt is exactly for that purpose. But I can't find a description in the Qt documentation of what Qwt is and how it works.

Can someone confirm whether or not I should be using Qwt and tell me where I can find documentation on that ?

---
A second issue that has been puzzling me:
I've read in the documentation (http://doc.qt.nokia.com/4.7/qgraphicssimpletextitem-members.html) that QGraphicsSimpleTextItem has a 'scale()' function that returns the current scale and a 'setScale(qreal) scale' function that sets one scale factor.
But when I type 'item->scale' in QtCreator, it also suggests another function, 'scale(qreal sx, qreal sy)', that apparently scales both dimensions invidually, but that I can't find in the documentation.

So, my questions are:
- Why is this apparently not in the documentation ?
- How do these two functions interact ? I've experimented with combining them, but I don't understand the results I get.

Thank you !

ChrisW67
4th October 2011, 22:19
Qwt (http://qwt.sourceforge.net/) is not part of Qt and therefore not documented as part of Qt. It has a sub-forum here because Qwt is quite popular. That forum seems to be routinely read by the author of Qwt.

DerManu
9th November 2011, 01:53
For (relatively) simple plots without a hassle, you might be interested in my QCustomPlot widget, see
http://www.workslikeclockwork.com/index.php/components/qt-plotting-widget
If you're into the Qt documentation (as most of us are, I guess), I might add, that I've done my best to make the documentation of QCustomPlot integrate well (see the documentation section on the site and the online documentation link (http://www.workslikeclockwork.com/other/qcustomplot-doc/index.html)).

Regarding your other question:
The function you see is inherited from QGraphicsItem. If you look at the qgraphicsitem.h header code, you'll see that the Qt developers have noted "// ### obsolete" next to it (along with rotate, shear and translate). I guess because it broke with the getter/setter approach when QTransforms found their way into Qt. If you nevertheless want to scale both dimensions, try making a QTransform (which now has the two-parametric scale method), and applying it to your text item with setTransform.

marcvanriet
9th November 2011, 21:26
Hi,

You could check out qt-apps.org (http://qt-apps.org). Under the 'widgets' section, you will find several small graphics widgets.

Regards,
Marc