Reputation: 21260
I need to implement some plot like that or that in my app , it can be even something similar.
I made a search on Qt web site with no progress , and I saw Qwt package but nothing similar there.
Any ideas?
Upvotes: 26
Views: 60087
Reputation: 5044
Qt 5.6 now includes Qt Charts 2.1, which supports bar charts (as well as 7 other kinds).
Upvotes: 3
Reputation: 6186
QCustomPlot
is really easy to get started and there is plenty of Cartesian plot types you can do. Having said that, performance-wise it is not as good as other people say if you intend to plot large time series all at once. It internally uses a QMap
to store the data which means that for every data point you insert or remove when populating, there is going to be one allocation / release of memory to add the data point to the map. See this post for more information.
Another thing I don't like is that even for simple plots it uses internally a struct QCPData
that stores 6 double values when you would normally need two (x
and y
). That is, it triples the amount of memory you need to display a time series.
Upvotes: 1
Reputation: 32635
I love QCustomPlot which is a Qt C++ library. It focuses on making good looking, publication quality 2D plots, graphs and charts and also has high performance for real-time visualization applications. You can get it here: http://www.qcustomplot.com/
Upvotes: 34
Reputation: 585
As an alternative to Qwt you might also consider qt-plotting-widget which may be a simpler option.
Upvotes: 7
Reputation: 1508
I'm using Qwt
for that. The trick is to use a step function (see last example by this link), and shift the data by 0.5, so that bars will be centered to ticks. Here is an example of what you can get with alpha blending and anti-aliasing enabled: my histogram.
Hope, you will do even better ;-)
Upvotes: 8
Reputation: 15269
I strongly recommend Qwt.
Qwt is a mature, well-documented library and, I think it's fair to say, the standard solution for implementing plots and other display and control widgets in Qt.
If you need 3D plots, try QwtPlot3D.
Upvotes: 29
Reputation: 328556
Qt has no support for plotting out of the box.
The most basic solution is to use QGraphicsView. Simply render your plot using the various items.
Other than that, you can follow this thread. It contains a couple of pointer to plotting frameworks but I don't know how useful they are or whether they are still supported in Qt 4.x.
Upvotes: 2