here is a class that converts double value of scale into string and display instead
{
public:
MyScaleDraw()
{
setLabelRotation( 0 );
setLabelAlignment( Qt::AlignLeft | Qt::AlignVCenter );
setSpacing( 10 );
}
virtual QwtText label
( double value
) const {
return h;
}
};
class MyScaleDraw: public QwtScaleDraw
{
public:
MyScaleDraw()
{
setTickLength( QwtScaleDiv::MajorTick, 10 );
setTickLength( QwtScaleDiv::MinorTick, 2 );
setTickLength( QwtScaleDiv::MediumTick, 0 );
setLabelRotation( 0 );
setLabelAlignment( Qt::AlignLeft | Qt::AlignVCenter );
setSpacing( 10 );
}
virtual QwtText label( double value ) const
{
QwtText h=QwtText(QString::number(value*0.75); //use any scaling factor you want
return h;
}
};
To copy to clipboard, switch view to plain text mode
include the following below code after creating a plot
d_plot
->setAxisScaleDraw
( QwtPlot::xBottom,
new MyScaleDraw
() );
d_plot
->setAxisScaleDraw
( QwtPlot::yLeft,
new MyScaleDraw
() );
d_plot->setAxisScaleDraw( QwtPlot::xBottom, new MyScaleDraw() );
d_plot->setAxisScaleDraw( QwtPlot::yLeft, new MyScaleDraw() );
To copy to clipboard, switch view to plain text mode
this solved my problem
Bookmarks