You have to derive from QwtScaleDraw and overload the label method:
{
public:
virtual QwtText label
( double value
) const {
const int index = qRound( value );
return ...
}
};
class YourScaleDraw: public QwtScaleDraw
{
public:
virtual QwtText label( double value ) const
{
const int index = qRound( value );
return ...
}
};
To copy to clipboard, switch view to plain text mode
and
plot
->setAxisScaleDraw
( QwtPlot::yLeft,
new YourScaleDraw
() );
plot->setAxisScaleDraw( QwtPlot::yLeft, new YourScaleDraw() );
To copy to clipboard, switch view to plain text mode
Have a look at the distrowatch example, that returns a label from a string list ( name of a distro ).
Of course this is not the most comfortable API for a bar chart - simply because it is using an API that is made for any type of coordinate system.
One idea I have is to add an optional module on top of the current APIs, that offers plots with a less powerful and flexible API, but with a very easy one, that is tailored for specific plot types.
Uwe
Bookmarks