rescale to data range when reploting
Hello,
I'm using this code I found on StackOverflow to fit the axis to the data range :
Code:
// the canvas should be perfectly aligned to the boundaries of your curve.
m_pChart->plotLayout()->setAlignCanvasToScales(true);
After the first replot, if I do some panning or zooming, the second replot will not fit the axis to the data range. In some cases that's fine, but there's case where I want to rescale the axis to the data range.
So do I have to store the min/max somewhere and use QwtPlot::setAxisScale or can this be done automatically (so less code to maintain).
Thanks.
Re: rescale to data range when reploting
You can assign the scale ranges manually or use autoscaling, but not both at the same time.
As soon as you change the scales manually by setAxisScale ( what is done by panning/zooming ) autoscaling gets turned off.
If you want to re-enable it you have to use QwtPlot::setAxisAutoScale(), what will have an effect in the next call of replot.
Uwe