#include <PlotDateTimeScaleEngine.h>
List of all members.
Constructor & Destructor Documentation
PlotDateTimeScaleEngine::PlotDateTimeScaleEngine |
( |
|
) |
|
PlotDateTimeScaleEngine::~PlotDateTimeScaleEngine |
( |
|
) |
[virtual] |
Member Function Documentation
void PlotDateTimeScaleEngine::autoScale |
( |
int |
maxSteps, |
|
|
double & |
x1, |
|
|
double & |
x2, |
|
|
double & |
stepSize | |
|
) |
| | const [virtual] |
Reimplemented from QwtScaleEngine.
{
QwtDoubleInterval interval( x1, x2 );
interval = interval.normalized();
interval.setMinValue( interval.minValue() - lowerMargin() );
interval.setMaxValue( interval.maxValue() + upperMargin() );
if ( testAttribute( QwtScaleEngine::Symmetric ) )
interval = interval.symmetrize( reference() );
if ( testAttribute( QwtScaleEngine::IncludeReference ) )
interval = interval.extend( reference() );
if ( interval.width() == 0.0 )
interval = buildInterval( interval.minValue() );
stepSize = divideInterval( interval.width(), qwtMax( maxNumSteps, 1 ) );
if ( !testAttribute( QwtScaleEngine::Floating ) )
interval = align( interval, stepSize );
x1 = interval.minValue();
x2 = interval.maxValue();
if ( testAttribute( QwtScaleEngine::Inverted ) )
{
qSwap( x1, x2 );
stepSize = -stepSize;
}
}
double PlotDateTimeScaleEngine::divideInterval |
( |
double |
intervalSize, |
|
|
int |
numSteps | |
|
) |
| | const [virtual] |
Reimplemented from QwtScaleEngine.
Referenced by autoScale(), and divideScale().
{
if ( numSteps <= 0 )
return 0.0;
double x = QwtScaleArithmetic::divideEps( intervalSize, numSteps );
if ( x == 0.0 )
return 0.0;
const double sign = ( x > 0 ) ? 1.0 : -1.0;
const double lx = log( fabs( x ) ) / log( 60.0 );
const double p10 = floor( lx );
double fr = pow( 60.0, lx - p10 );
if ( fr <= 1.0 )
fr = 1.0;
else if ( fr <= 2.0 )
fr = 2.0;
else if ( fr <= 5.0 )
fr = 5.0;
else if ( fr <= 10.0 )
fr = 10.0;
else if ( fr <= 20.0 )
fr = 20.0;
else if ( fr <= 30.0 )
fr = 30.0;
else
fr = 60.0;
return sign * fr * pow( 60.0, p10 );
}
QwtScaleDiv PlotDateTimeScaleEngine::divideScale |
( |
double |
x1, |
|
|
double |
x2, |
|
|
int |
numMajorSteps, |
|
|
int |
numMinorSteps, |
|
|
double |
stepSize = 0.0 | |
|
) |
| | const [virtual] |
Reimplemented from QwtScaleEngine.
{
QwtDoubleInterval interval = QwtDoubleInterval( x1, x2 ).normalized();
if ( interval.width() <= 0 )
return QwtScaleDiv();
stepSize = qwtAbs( stepSize );
if ( stepSize == 0.0 )
{
if ( maxMajSteps < 1 )
maxMajSteps = 1;
stepSize = divideInterval( interval.width(), maxMajSteps );
}
QwtScaleDiv scaleDiv;
if ( stepSize != 0.0 )
{
QwtValueList ticks[ QwtScaleDiv::NTickTypes ];
buildTicks( interval, stepSize, maxMinSteps, ticks );
scaleDiv = QwtScaleDiv( interval, ticks );
}
if ( x1 > x2 )
scaleDiv.invert();
return scaleDiv;
}
The documentation for this class was generated from the following files: