Results 1 to 3 of 3

Thread: How to know scale span in QwtScaleDraw class

  1. #1
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to know scale span in QwtScaleDraw class

    I want to display labels on x-axis according to the x-axis span. So if x-axis goes from 0-1000 I want to show label in certain format. However, if x-axis span is from 0-10000, I want the format to be different. I know that I need to derive from QwtScaleDraw and reimplement QwtScaleDraw::label(double) function to change the label. However, I cannot find a way to know what is the span of x-axis so that I send the requisite text format type.
    Is there a way to know it from this class? If not, is there a work-around?

  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: How to know scale span in QwtScaleDraw class

    Quote Originally Posted by pkj View Post
    I know that I need to derive from QwtScaleDraw and reimplement QwtScaleDraw::label(double) function to change the label. However, I cannot find a way to know what is the span of x-axis so that I send the requisite text format type.
    Qt Code:
    1. const QwtScaleDiv& QwtAbstractScaleDraw::scaleDiv() const;
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. #3
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to know scale span in QwtScaleDraw class

    I think that QwtAbstractScaleDraw::scaleDiv().lowerBound and QwtAbstractScaleDraw::scaleDiv().upperBound() will give me the scales. But going through this thread it seems that lower bound is first set, and then upperbound is set. So does that mean the first time this class is implicitly asked for label, since its upper and lower bounds are not set by that time, the logic to send text based on bounds will fail?
    Last edited by pkj; 14th September 2011 at 08:56. Reason: You beat me with that post, Uwe, thanks

Similar Threads

  1. Replies: 2
    Last Post: 15th July 2011, 08:25
  2. Replies: 0
    Last Post: 23rd February 2011, 01:07
  3. QwtScaleDraw align label to xaxis
    By kja in forum Qwt
    Replies: 1
    Last Post: 21st November 2010, 20:55
  4. Replies: 1
    Last Post: 14th October 2010, 19:56
  5. QTableWidget span !
    By stephanyShulter in forum Newbie
    Replies: 2
    Last Post: 27th October 2008, 15:20

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.