Results 1 to 2 of 2

Thread: Question about qwt polar's Azimuth scale

  1. #1
    Join Date
    Jun 2008
    Posts
    18
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Question about qwt polar's Azimuth scale

    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!
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Question about qwt polar's Azimuth scale

    Qt Code:
    1. plot->setScale(QwtPolar::Azimuth, 360.0, 0.0, 15.0);
    To copy to clipboard, switch view to plain text mode 

    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:

    Qt Code:
    1. class YourScaleDraw: public QwtRoundScaleDraw
    2. {
    3. virtual QwtText label(double value) const
    4. {
    5. return QwtRoundScaleDraw::label(::fmodf(value, 360.0) );
    6. }
    7. };
    8.  
    9. plot->setScaleDraw(QwtPolar::Azimuth, new YourScaleDraw);
    To copy to clipboard, switch view to plain text mode 

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    qmonkey (9th October 2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.