Isn't your question about how to configure the auto scaler to adjust the scale being symmetric according to the center of the given range ?
Maybe setting the QwtScaleEngine::Floating flag is already good enough - if not you can try the code below:
{
public:
MyScaleEngine()
{
}
virtual void autoScale( int maxNumSteps, double &x1, double &x2, double &stepSize ) const
{
MyScaleEngine *that = const_cast<MyScaleEngine *>( this );
that->setReference( 0.5 * ( x1 + x2 ) );
}
};
class MyScaleEngine: public QwtLinearScaleEngine
{
public:
MyScaleEngine()
{
setAttribute( QwtScaleEngine::Symmetric, true );
}
virtual void autoScale( int maxNumSteps, double &x1, double &x2, double &stepSize ) const
{
MyScaleEngine *that = const_cast<MyScaleEngine *>( this );
that->setReference( 0.5 * ( x1 + x2 ) );
QwtLinearScaleEngine::autoScale( maxNumSteps, x1, x2, stepSize );
}
};
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks