PDA

View Full Version : Question about qwt polar's Azimuth scale



qmonkey
7th October 2008, 16:42
Hi,

I want to set my polar plot's Azimuth scale to 0~360 degree clock-wise and display 0 degree at the start instead of 360. Attached is my current plot showing 360 degree. Anybody knows how to change it to 0 degree(clock-wise)?

Thank you!

Uwe
9th October 2008, 08:23
plot->setScale(QwtPolar::Azimuth, 360.0, 0.0, 15.0);

Looking into QwtRoundScaleDraw::drawLabel you can see, that ticks that are mapped to a position >= 360 degree ( 0.0 is mapped to 360 ) are skipped. Unfortunately this is hardcoded.

I'm afraid you need to derive your own type of scale draw:


class YourScaleDraw: public QwtRoundScaleDraw
{
virtual QwtText label(double value) const
{
return QwtRoundScaleDraw::label(::fmodf(value, 360.0) );
}
};

plot->setScaleDraw(QwtPolar::Azimuth, new YourScaleDraw);

Uwe