PDA

View Full Version : Qwt: Axis Border Dist?



alperyazir66
22nd September 2014, 09:54
I have two plots which has created by using qwt. But I couldn't sync their axis(xBottom) with each other.

10634


They both have (30,30) BorderDist



plot1->axisWidget(QwtPlot::xBottom)->setMinBorderDist(30,30) //distance between axis and border
plot2->axisWidget(QwtPlot::xBottom)->setMinBorderDist(30,30) //distance between axis and border

but only upper plot apply this function and there is a difference between axises.

How can I solve this?

Regards.

Uwe
22nd September 2014, 12:28
What about this:


const int margin = 30;
plot1->plotLayout()->setCanvasMargin( margin, QwtPlot::yLeft );
plot1->plotLayout()->setCanvasMargin( margin, QwtPlot::yRight );
plot2->plotLayout()->setCanvasMargin( margin, QwtPlot::yLeft );
plot2->plotLayout()->setCanvasMargin( margin, QwtPlot::yRight );You probably need Qwt 6.1.1 - AFAIR 6.1.0 had a bug when setting canvas margins in combination with hidden axes.

Uwe

alperyazir66
22nd September 2014, 13:29
Hey Uwe,

I tried you advise but when i does:

enableAxis(QwtPlot::xBottom,false) for plot2, it doesn't care margin value. By the way I tried also in version6.1.1 it has same result.

Uwe
22nd September 2014, 13:52
Adding the following lines to the simpleplot example in the 6.1 branch shows the expected result:


plot.enableAxis( QwtPlot::xBottom, false );
plot.plotLayout()->setCanvasMargin( 30, QwtPlot::yLeft );
plot.plotLayout()->setCanvasMargin( 30, QwtPlot::yRight );Guess something went wrong on your side with installing/using Qwt 6.1.1 ?

Uwe

alperyazir66
22nd September 2014, 14:17
I think "axis numbers" cause this problem. if I give border width enough, two plots axises are great.

Thanks again Uwe.

Uwe
22nd September 2014, 17:21
I think "axis numbers" cause this problem.
Yes of course - there needs to be space for the outer halfs of the outmost tick labels.

Both - the border distances of the scale widgets and the canvas margins - have the effect to create extra spaces, but the canvas margin works regardless if a scale is hidden or not.

Uwe