Log in

View Full Version : qwt axis scale



Markus_AC
15th December 2011, 09:45
I'm trying to adopt the x-axis scale of my QwtPlot (qwt. 6.0.1).

I want to do some kind of auto-scale, because in my opinion qwt's autoscale engine does quite well.
I changed qwt's sources so far in qwt_scale_engine.cpp:

original:


double QwtScaleEngine::divideInterval(
double intervalSize, int numSteps ) const
{
if ( numSteps <= 0 )
return 0.0;

double v = QwtScaleArithmetic::divideEps( intervalSize, numSteps );
return QwtScaleArithmetic::ceil125( v );
}

my modifications:


double QwtScaleEngine::divideIntervalNoCeil(
double intervalSize, int numSteps ) const
{
if ( numSteps <= 0 || intervalSize == 0.0)
return 0.0;

return (intervalSize / numSteps);
}


The original code scales very good intervals, but the curve isn't painted up to the right border. The last point of my curve is somewhere between the last and the last but one scale-division.
The result of my changes is that my curve is painted over all the canvas from the left to the right border, but I get interval-sizes of double numbers (e.g. 317 points / interval).
But I want to change the code further with the result, that I want to get interval-sizes, which the original code from above will scale (20, 100, 1000, ...), but my curve is painted all over the canvas, as my modification does. So the first intervals will be of the same size (e.g. 20 points / interval) and the last interval will be shorter (e.g. 11 points / interval).

What can I do?