[Interest] Handling zooming in QtCharts
Lorne Sturtevant
dragor at shaw.ca
Mon Jun 20 23:54:47 CEST 2016
I have been using QtCharts and so far it's going ok. I can create basic
charts without problems. I am noticing some holes in the API which I
imagine is just due to the fact that it's new.
One big problem I'm having is with zooming. The functions
QChart::zoomIn() and QChart::zoomOut() only allow zooming from the
center of the chart. I use the mouse wheel to zoom and I would like
that to be done at the mouse's position. So far, I cannot find a way to
do this.
My first idea was to subclass QChart and just add a function to do it
myself. The problem with this, is that all the data I need to calculate
the zoom point is in QChartPrivate, so that won't work. I also thought
about changing the range of the axis based on where the mouse is, but I
can't see a way of getting the location of the grid lines to do an
accurate calculation. All the data I need is again private.
So my question is, how would I do this? How can I zoom the chart around
the position of the mouse without accessing any of the private data from
the QtChart package? Is there some method I'm missing? Or is the API
just not able to do this right now?
--
Lorne Sturtevant
Sum Ergo Cogito
More information about the Interest
mailing list