Menu

#246 QwtScaleDiv::range() gives back a wrong value for a logarithmic scale

None
closed
nobody
None
1
2015-07-27
2015-07-27
Anonymous
No

I have a logarithmic scale in y-Axis like this:

enableAxis( QwtPlot::yLeft, true );
setAxisTitle( QwtPlot::yLeft, QString("Pressure [%1]").arg("mbar") );
pyLogScale = new LogScaleEngine;
setAxisScaleEngine( QwtPlot::yLeft, pyLogScale );
setAxisMaxMajor( QwtPlot::yLeft, 14 );
setAxisMaxMinor( QwtPlot::yLeft, 10 );
setAxisScale( QwtPlot::yLeft, 1e-10, 2000 );
setAxisAutoScale( QwtPlot::yLeft, false );

A QwtScaleDiv like this

QwtScaleDiv scaleDiv = this->axisScaleDiv( QwtPlot::yLeft );
qDebug() << scaleDiv.upperBound() << scaleDiv.lowerBound() << scaleDiv.range();

gives an output
2000 1E-10 2000

upperBound() is OK
lowerBound() is OK
range() is NOT OK

QwtScaleDiv::range() gives back a wrong value for a logarithmic scale

Discussion

  • Uwe Rathmann

    Uwe Rathmann - 2015-07-27
    • status: open --> closed
    • Group: -->
     
  • Uwe Rathmann

    Uwe Rathmann - 2015-07-27

    range is simply: upperBound() - lowerBound().

    Then your situation is a combination of the limited significance of doubles and an inaccurate debug operator.

     

Anonymous
Anonymous

Add attachments
Cancel