The rescaler automatically adjusts the scales to resize events of the canvas. When changing the scale range of the reference axis you have to call QwtPlotRescaler::rescale() manually.
Plot::Plot()
{
m_rescaler
= new QwtPlotRescaler
( canvas
(),
QwtPlot::xBottom, QwtPlotRescaler
::Fixed );
m_rescaler
->setAspectRatio
( QwtPlot::yLeft,
1.0 );
}
Plot::Plot()
{
m_rescaler = new QwtPlotRescaler( canvas(), QwtPlot::xBottom, QwtPlotRescaler::Fixed );
m_rescaler->setAspectRatio( QwtPlot::yLeft, 1.0 );
}
To copy to clipboard, switch view to plain text mode
and something like this:
void Plot::expandReferenceAxis()
{
const QwtInterval interval = axisInterval( m_rescaler->referenceAxis() );
plot->setAxisScale( m_rescaler->referenceAxis(), interval.minValue(), interval.minValue() + interval.width() + 1000 );
plot->updateAxes(); // no relot to avoid flickering
m_rescaler->rescale(); // now sync the y axis + replot
}
void Plot::expandReferenceAxis()
{
const QwtInterval interval = axisInterval( m_rescaler->referenceAxis() );
plot->setAxisScale( m_rescaler->referenceAxis(), interval.minValue(), interval.minValue() + interval.width() + 1000 );
plot->updateAxes(); // no relot to avoid flickering
m_rescaler->rescale(); // now sync the y axis + replot
}
To copy to clipboard, switch view to plain text mode
It might be possible to connect QwtPlotRescaler::rescale() to QwtScaleWidget::scaleDivChanged() signal of the reference axis - but I have not tried it.
Uwe
Bookmarks