Originally Posted by
Uwe
This thread is about a scrollview - and the idea posted there the same for Qwt 6.1. Does this answer help: no.
So better answer my question and explain your situation.
Uwe
Uwe,
I have the similar situation mentioned in that thread.
In that thread you provided codes like this:
1.void XXX::syncScale(int axis)
2.{
3. ...
4.
5. yourScale->setScaleDiv(
6. plot->axisScaleEngine(axis)->transformation(),
7. plot->axisWidget(axis)->scaleDiv() );
8.
9. int startDist, endDist;
10. yourScale->getBorderDistHint(startDist, endDist);
11. yourScale->setBorderDist(startDist, endDist);
12.
13.}
14.
15.connect(plot->axisWidget(...), SIGNAL(scaleDivChanged(),
16. ..., SLOT(syncScale() );
but I don't find a function which is like the following one in the class QwtScaleWidget
yourScale->setScaleDiv( plot->axisScaleEngine(axis)->transformation(), plot->axisWidget(axis)->scaleDiv() );
What I've found is setScaleDiv( const QwtScaleDiv &sd ) and setTransformation( QwtTransform * ).
So I am confused.
What I have tried is like this:
initPlot()
{
myplot = new QwtPlot();
myplot -> enableAxis( QwtPlot::yLeft, false );
myplot -> enableAxis( QwtPlot::xBottom, false );
myplot -> setAxisAutoScale( QwtPlot::yLeft, false );
myplot -> setAxisAutoScale( QwtPlot::xBottom, false );
//some plot items initialization
...
updateAxes();
}
updateAxes()
{
//for each axis of the four, I try to set the same transformation and scalediv for left and right axes or top and bottom axes
scaleWidget[Left] -> setTransformation( myplot -> axisScaleEngine( QwtPlot::yLeft ) -> transformation() );
scaleWidget[Right] -> setTransformation( myplot -> axisScaleEngine( QwtPlot::yLeft ) -> transformation() );
scaleWidget[Left] -> setScaleDiv( myplot -> axisScaleDiv( QwtPlot::yLeft ) );
scaleWidget[Right] -> setScaleDiv( myplot -> axisScaleDiv( QwtPlot::yLeft ) );
int startDist, endDist;
scaleWidget[Left] -> getBorderDistHint( startDist, endDist );
scaleWidget[Left] -> setBorderDist( startDist, endDist );
scaleWidget[Right] -> setBorderDist( startDist, endDist );
//the similar codes for scaleWidget[Top] and scaleWidget[Bottom]
//...
}
but when the plot is shown, it looks like the picture I've attached in this thread before.
and the ticks are not aligned with the contents of the plot.
Your fan,
Nicho
Bookmarks