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?
QCustomPlot is a Qt C++ widget for plotting and data visualization. It has no further dependencies and is well documented. This plotting library focuses on making good looking, publication quality 2D plots, graphs and charts, as well as offering high performance for realtime visualization applications.
Widgets are the primary elements for creating user interfaces in Qt. Widgets can display data and status information, receive user input, and provide a container for other widgets that should be grouped together. A widget that is not embedded in a parent widget is called a window.
Qt is the complete software development framework. The Qt framework contains a comprehensive set of highly intuitive and modularized C++ library classes and is loaded with APIs to simplify your application development.
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/
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.
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 ;-)
As an alternative to Qwt you might also consider qt-plotting-widget which may be a simpler option.
Qt 5.6 now includes Qt Charts 2.1, which supports bar charts (as well as 7 other kinds).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With