PDA

View Full Version : Change Label qwtpolarplot



stepner03
12th April 2016, 14:58
I'm using a qwtpolarplot widget from 180 to -180, and I need that the widgets on the axes:

360 -----------> 180
270 -----------> -90
180 -----------> -180
90 -----------> 90

how can I change this label?

11876

Uwe
12th April 2016, 18:01
http://www.qtcentre.org/threads/65653-change-scale-map-of-QwtPolarGrid-number!

Uwe

stepner03
13th April 2016, 06:44
Thanks for your help...
Another solution is the following:

class AzimuthScaleDraw: public QwtRoundScaleDraw
{
public:
virtual QwtText label( double value ) const
{
QwtText text;
double valueReturn;

if ((value>0) && (value < 180))
{
valueReturn = value;
}
else if ((value == 0) || (value ==360))
{
valueReturn = 180;
}
else if ((value == 180))
{
valueReturn = -180;
}
else
{
valueReturn = value -360;
}
return QwtRoundScaleDraw::label( valueReturn );
}
};

and use:

QwtPolarGrid *grid;

grid->setAzimuthScaleDraw( new AzimuthScaleDraw() );


what do you think about it ????

Uwe
13th April 2016, 14:07
Well your code changes the labels, but not the transformation - so it depends on your data. If a point at -180 has to be displayed at 180 your code does it, if the coordinates of your data is intended to match the scales my proposal is better.

Uwe

stepner03
14th April 2016, 07:18
Thanks...yes my code change only labels !!!! For transformer poin plot I used the example code qwt spectrogram !!!