Simple histogram widget
I don't want to reinvent the wheel and was looking for an histogram widget and I was surprised to find almost nothing.
Ok there is Qwt. Their histogram class is not suitable to display an image histogram, but I could use QwtPlot. From what I have read it looks like it's a too complex solution for my very simple need.
I also found KD Chart. Look nice but it not free.
Is there anything else that I may have missed? Or should I start frm scratch? This histogram won't be a main component of my application that's why I'm a bit lazy :p
Ended up with that:
KDChart is available as open source (LGPL, I think).
They don't advertise it, but if you download the trial version, and you look at the licence files, you will find that it actually has quite a liberal licence.
P.S. You are right that you want to reuse an existing component for something like this, I think!
I downloaded and compiled KDChart. Then I tried to launch one of their examples and was welcomed with a bunch of error message ("Must construct a QApplication before a QPaintDevice").
Is this library maintained?
I managed to get a simple histogram using KDChart.
However the documentation look outdated. They provide a plugin for Designer but it won't load.
Do you still use this library Andre?
No, I am currently not using this library.
I have performance issues with KDChart. The whole GUI lags when trying to refresh an 256bins histogram at 24fps. A part from that the library is pretty.
I had to downsize my dataset to 64 bins until I find something better.
I finally wrote my own class.
Currently I kept it very basic. I subclassed QWidget, reimplemented the paintEvent() and called drawLine on my bins.
Now I would like to add a bit of eyecandy and fill the area under the plot with a simple vertical gradient.
Since I need to be able to refresh this ~50 times per seconds, is it risky to add this kind of unnecessary enhancements?
What is recommended, drawing a polygon could be better?
Okay, I finally replaced my drawLine() calls with a polygon and a simple gradient.
Added a few vertical bars that scales nicely with the widget width.
Looks quite pretty, actually! Nice work.
Seems very cool!
Thanks a lot.
I might share it after a bit of cleanup.
Code freely available here:
Feel free to contribute!