
Originally Posted by
icosahedron
Will overloading QwtPlot::setAxisScaleEngine() allow me to reflect irregularity from prepared QwtScaleDiv ?
{
public:
virtual QwtScaleDiv divideScale
( double x1,
double x2,
int ,
int ,
double ) const {
const QwtInterval interval = QwtInterval( x1, x2 ).normalized();
// fill the ticks somehow according to interval
// here you can set whatever ticks you want as long as
// they are inside the interval x1/x2
....
if ( x1 > x2 )
scaleDiv.invert();
return scaleDiv;
}
};
class YourScaleEngine: public QwtLinearScaleEngine
{
public:
virtual QwtScaleDiv divideScale( double x1, double x2, int , int , double ) const
{
const QwtInterval interval = QwtInterval( x1, x2 ).normalized();
QList<double> ticks[QwtScaleDiv::NTickTypes];
// fill the ticks somehow according to interval
// here you can set whatever ticks you want as long as
// they are inside the interval x1/x2
ticks[QwtScaleDiv::MajorTick] += ...;
....
QwtScaleDiv scaleDiv( interval, ticks );
if ( x1 > x2 )
scaleDiv.invert();
return scaleDiv;
}
};
To copy to clipboard, switch view to plain text mode
and
plot->setAxisScaleEngine( axis, new YourScaleEngine() );
plot->setAxisScaleEngine( axis, new YourScaleEngine() );
To copy to clipboard, switch view to plain text mode
Also it completely puzzles me why setAxisScaleDiv() works only once at plot creation time ?
Because all what modifies a scale ( f.e panning, zooming ) has to do it in the end with setAxisScaleDiv() and your initial assignment gets overwritten.
Uwe
Bookmarks