How is best way to change the scale range?
Hi all.
E.g. I have some Plot with two axes (X and Y). I need to implement changing of
the Y-axis range using "dragging" with the mouse. It is looks like the user dragging
the Y-axis to up or down (like using wheels scrolling).
I have implemented the mouse filter and intercept the MousePressed/Move/Released
events. In this case I just re-calculate the desired Y-axis ranges and change its
with:
Code:
...
QwtPlot::setAxisScale(axis, newMin, newMax, newStep
);
...
It is similar to the code from the "event_filter" example with the scrollLeftAxis()
method.
BUT, I'm not sure that is is best way in point of view performance. Maybe is it
better to use the QwtPlotZoomer or other stuff? Could, please, someone advise
something for this issue?
BR,
Denis
Re: How is best way to change the scale range?
Changing the axes is always done with QwtPlot::setAxisScale or QwtPlot::setAxisScaleDiv ( if you want to set the ticks manually ).
QwtPlotZoomer, QwtPlotMagnifier etc are only noise on top.
The only thing that's different is QwtPlotPanner as it grabs the content to an image moving it around without causing replots until releasing it.
But this is visually not perfect. Have a look the the spectrogram example ( drag with the middle mouse button ).
Uwe
Re: How is best way to change the scale range?
Ahh.. yes, I have looked on QwtPlotZoomer, and see that its method void QwtPlotZoomer::rescale() use setAxisScale()... :)
Many thanks...