PDA

View Full Version : Remove space between axis and plot



Ozzy
14th January 2014, 18:46
Hey,

I'm doing my first steps with qwt for a new project, but I have run in some little problems. I try to remove the space between the x-axis and the the plot so that the x-axis is located on the baseline. But I don't get it work. This is my current approach:



ui->qwt_Curve->plotLayout()->setAlignCanvasToScales(true);
ui->qwt_Curve->axisWidget(QwtPlot::xBottom)->setMargin(0);
ui->qwt_Curve->axisWidget(QwtPlot::xBottom)->setSpacing(0);
ui->qwt_Curve->axisWidget(QwtPlot::xBottom)->scaleDraw()->setMinimumExtent(0);
ui->qwt_Curve->plotLayout()->setCanvasMargin(0, QwtPlot::xBottom);


Do you have any hints for me?
Thanks and best regards
Ozzy

Uwe
15th January 2014, 06:36
dynamic_cast<QFrame*>(plot->canvas())->setFrameStyle( QFrame::NoFrame );
plot->axisWidget(QwtPlot::xBottom)->setMargin(0);

Uwe

Ozzy
15th January 2014, 06:58
Hi,

thanks for your reply. But there is still a very small space between the zero line and the axis-line. Is there any further trick to remove this and set the baseline to the zero line?

Uwe
15th January 2014, 07:50
thanks for your reply. But there is still a very small space between the zero line and the axis-line.
What zero line ?

Uwe

Ozzy
15th January 2014, 07:53
Hi,

when I plot a chart with only zero points (e.g. System load on a cpu with no load..) there is still a small space between the zero line and the axis.

Uwe
15th January 2014, 08:43
Again: what do you mean by "zero line" - the position of some value 0 of a y axis ?

Uwe

Ozzy
15th January 2014, 08:50
Right. The position of zero values on the x-axis (bottom).

Uwe
15th January 2014, 09:21
Better upload a screenshot of what you want to do.

Uwe

Ozzy
15th January 2014, 09:43
Hi,

9930

Here you can see that the points with 0.0 on the x axis are not on but above the axis. I hope it is getting clearer now.

Uwe
16th January 2014, 06:41
Please add gridlines for the y axis ( maybe in red ) and set the canvas background to cyan and upload another screenshot.

Uwe

Ozzy
16th January 2014, 07:10
Hi,

this is the new plot:
9934

Thanks and best regards
Ozzy

Uwe
16th January 2014, 08:02
Where you can see, that the zero line ( 0 at y left ) is exactly the first pixel in the canvas.

You could disable the backbone of the scales ( see QwtScaleDraw ) and draw a line at y=0 inside the canvas - if this is what you want to do.

Uwe

Ozzy
16th January 2014, 13:48
Hi,

thanks for your reply! This works for me!!!

Thanks and best regards
Ozzy