Visualize value on Qt Chart View
-
Hi everyone,
So I've been playing around with Qt Charts now that it's available under GPLv3, and I got some trouble displaying data.
I'm using a QBarSeries to create a bar chart that displays some amount. Everything is fine, but the data visualization is kind of lightweight. I'd like to display the real amount of a bar, say in a tooltip when hovering the bar at least.
For the moment, There are only 3 or 4 values on the y-axis, but there is no way to know precisely the real value of each bar.
Am I missing something in the documentation? Do I have to implement it myself ? If so, what do I have to subclass: QChart, QChartView, QLegend, QBarSeries?
-
See the callout example: http://doc.qt.io/qt-5/qtcharts-callout-example.html
-
I missed that example, thanks a lot @VRonin!
So yeah, I have to subclass a view and do the tooltip like display myself using mapToValue, as I suspected.
I won't close this post yet, just in case someone else has something to add.
-
OK so this example is about QLineSeries, not QBarSeries, and there is a reason: QLineSeries has clicked(QPointF) and hovered(QPointF, bool) signals, QBarSeries doesn't.
So I think I'll have to simply implement a BarView that displays the value, using QGraphics framework.