View Full Version : Axis's minimum and maximum

11th June 2008, 17:56
I was wondering if it is possible to find minimum and maximum (lBound and hBound) of given axis.
THe QwtPlot Documentation vaguely mentions about it:

const QwtScaleDiv * QwtPlot::axisScaleDiv (int axisId ) const
Return the scale division of a specified axis.
axisScaleDiv(axisId)->lBound(), axisScaleDiv(axisId)->hBound() are the current limits of the axis scale.

However, when I tried to use it, it always returned me 0 for lBound and hBound.
Is there any other way to get minimum and maximum on a scale?

If it is difficult to get minimum and maximum of a axis, I have modified my Qwt and implemented couple of methods in QwtPlot class:
double axislBound(int axisId);
double axishBound(int axisId);
where axisId is the enum for axis and these functions return l or h bound of that axis or 0 if axisId is invalid.
I would very much appreciate your help if there already exist a simple way to get these values, or if not, if this would be a good patch.

11th June 2008, 22:16
axisScaleDiv(...)->lBound()/hBound is the right way to get the axes limits. But note, that the QwtScaleDivs need to be calculated before you can access them. I guess you called the getters before the first replot().


11th June 2008, 23:36
Hi Uwe,
I cant thank you more, it worked perfectly with replot();
I am actually trying to resize the plot by dragging one of the canvas's border. I had created an invisible path on the top of canvas's border and upon certain events, I was resizing the graph to match the path. Wont calling replot() every time mouse is moved (while holding my invisible path) cause some not so smooth resizing of the plot? Would updateAxes() serve the purpose? Also, is there any way I can display the canvas's border with different color/thickness?
I really appreciate your time and response.

16th June 2008, 07:13
a) When you resize the canvas and you want to adopt its content to the new size you need to call replot.
b) QwtPlotCanvas is a QFrame.


16th June 2008, 21:38
Thanks Uwe,