{
YourPlot( ... ):
{
....
connect( axisWidget
( QwtPlot::xBottom ),
SIGNAL( scaleDivChanged() ), SLOT( syncScales() ) );
}
void syncScales()
{
const double min = scaleDiv.lowerBound() * ...;
const double max = scaleDiv.upperBound() * ...;
setAxisScale
( QwtPlot::xTop, min, max
);
}
}
class YourPlot: public QwtPlot
{
YourPlot( ... ):
QwtPlot( ... )
{
....
enableAxis( QwtPlot::xTop );
connect( axisWidget( QwtPlot::xBottom ),
SIGNAL( scaleDivChanged() ), SLOT( syncScales() ) );
}
void syncScales()
{
const QwtScaleDiv scaleDiv = axisScaleDiv( QwtPlot::xBottom );
const double min = scaleDiv.lowerBound() * ...;
const double max = scaleDiv.upperBound() * ...;
setAxisScale( QwtPlot::xTop, min, max );
}
}
To copy to clipboard, switch view to plain text mode
Then attach your curve to xBottom.
Uwe
Bookmarks