Results 1 to 3 of 3

Thread: Stopping the tick mark value changing exponent

  1. #1
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Stopping the tick mark value changing exponent

    Hi again,
    Is it possible to stop the tick mark values changing from 998,999 to 1.0? Since there is no exponent label on the graph, to the user it looks like its going from 999 back to 1.

    See the image for an image of what I mean.

    Thanks again,
    Attached Images Attached Images
    Best Regards,
    Phil Winder
    www.philwinder.com

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

    Default Re: Stopping the tick mark value changing exponent

    Mapping the tick values int labels is done by QwtAbstractScaleDraw::label():

    Qt Code:
    1. QwtText QwtAbstractScaleDraw::label(double value) const
    2. {
    3. return QLocale::system().toString(value);
    4. }
    To copy to clipboard, switch view to plain text mode 

    Overload it if you want something different.

    Uwe

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

    philwinder (5th October 2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Stopping the tick mark value changing exponent

    Phil,

    I think what you are seeing is a locale problem. The tick marks aren't going from 999 to 1, they are going from 999 to 1000. Somehow, your locale is set to use a "." (period) instead of a "," (comma) to indicate the thousands position.

    As Uwe said, if you don't want the thousands delimiter, you need to override the label() method in your own QwtScaleDraw-derived class.

Tags for this Thread

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.