View Full Version : auto rescaling

17th December 2007, 20:56
Hi Ive made a graph using qwt and its examples...
I want to ask...is there any option to make it look the way that it displays axis only that long as many values it stores....I mean...Im displaying 23 values...but the X-axis are displayed to 25 value
Plus max value of my graph is 10 and graph displays Y-axis to value 10 so I can barely see the plot...
see the attachement picture...

17th December 2007, 23:19
ok so I didnt find out any answers even after searching the docs so Im gonna let this the way it is :)...
The only question is why does it scaling X:bottom Axis by by 5 ?
Does anyone know how to set some kind of "factor" od scaling ?

17th December 2007, 23:22
I don't have Qwt at hand, but AFAIR there was an example with automatic scale.

18th December 2007, 09:45
Well, let me try to explain. Each axis has a QwtScaleEngine, which calculates the scale. And if you have autoScale enabled, an automatic QwtScaleEngine is calculated depending on the range of your data, where the margins of the axis are rounded to "nice values", hence the 10 on your yAxis.
If you do not like the autoScale values, you have to override autoScaling by explicitly calling QwtPlot::setAxisScale(int axisId, double min, double max, double step = 0).
Your second question: You can set the number of ticks and/or labels with QwtPlot::setAxisMaxMajor(int axisId, int maxMajor) and QwtPlot::setAxisMaxMinor(int axisId, int maxMinor).