How to idenfity which move was performed by a zoom event
Hello Uwe!
As you may remember, I'm using QwtPlotTradingCurve to display a chart graph. I noticed that one must use setSymbolExtent() in order to define the width of the candlestick, and that such width is kind of a parameter that changes when the Qwt::xBottom changes (if everything is right...). Now the problem is that I noticed that putting the setSymbolExtent() value to the one presented in the stockchart example (12 * 3600 * 1000.0) is only good when the stock is quite zoomed out; but when we zoom in, one can begin to noticed that the candles are too far away from each other.
So I guess I should change the setSymbolExtent() value each time a zoom movement is performed. The problem is that I need to know if the zoom event was a zoom in or a zoom out (so to know if a must call
Code:
graphCandleCurve->setSymbolExtent( graphCandleCurve->symbolExtent() * 1.1f );
or
Code:
graphCandleCurve->setSymbolExtent( graphCandleCurve->symbolExtent() * 0.9f );
for example. My question is: is there a way to know if the zoom event is a zoom in or a zoom out with the Qwt library alone?
Thanks,
Momergil
Obs.: consider QwtPlotZoomer and QwtPlotMagnifier at least.
Re: How to idenfity which move was performed by a zoom event
Quote:
Originally Posted by
Momergil
So I guess I should change the setSymbolExtent() value each time a zoom movement is performed. The problem is that I need to know if the zoom event was a zoom in or a zoom out (so to know if a must call
No, if you need to adjust the extent, calculate it from the current scale - it is not important what the previous scale or the previous value of the extent was.
Simply connect to the QwtScaleWidget::scaleDivChanged() signal ( you already know how to do it ). With QwtPlot::axisScaleDiv() you find out what the current scale boundaries are.
Uwe
Re: How to idenfity which move was performed by a zoom event
Quote:
Originally Posted by
Uwe
Simply connect to the QwtScaleWidget::scaleDivChanged() signal ( you already know how to do it ). With QwtPlot::axisScaleDiv() you find out what the current scale boundaries are.
Uwe
Sorry, but I wasn't able to understand how such boundaries can tell me if I need to make the candles's width fatter or thinner and how much. Could you tell me a little bit more abou this methodology?