Results 1 to 2 of 2

Thread: Axis with more labels

  1. #1
    Join Date
    Aug 2009
    Posts
    56
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Axis with more labels

    Right now the two axes for my qwtPlot shows 6 labels, 0, 200, 400, 600, 800, and 1000. I want to make it show 11 instead, that is 0, 100, 200, 300, etc.

    I tried this, but it doesn't work

    Qt Code:
    1. const QwtScaleDiv *scaleDivHorizontal = qwtPlot->axisScaleDiv(QwtPlot::xBottom);
    2. const QwtScaleDiv *scaleDivVertical = qwtPlot->axisScaleDiv(QwtPlot::yLeft);
    3. double horizontalLowerBound=scaleDivHorizontal->lowerBound();
    4. double horizontalUpperBound=scaleDivHorizontal->upperBound();
    5. double verticalLowerBound=scaleDivVertical->lowerBound();
    6. double verticalUpperBound=scaleDivVertical->upperBound();
    7. double horizontalStepSize, verticalStepSize;
    8. qwtPlot->axisScaleEngine(QwtPlot::xBottom)->autoScale(11,horizontalLowerBound,horizontalUpperBound,horizontalStepSize);
    9. qwtPlot->axisScaleEngine(QwtPlot::yLeft)->autoScale(11,verticalLowerBound,verticalUpperBound,verticalStepSize);
    To copy to clipboard, switch view to plain text mode 

    Any help would be appreciated.

  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: Axis with more labels

    Qt Code:
    1. plot-setAxisMaxMajor(..., 10);
    To copy to clipboard, switch view to plain text mode 
    Use QwtPlot::setAxisScaleDiv() is you need to assign your ticks explicitely.

    Uwe

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

    rakkar (11th October 2009)

Similar Threads

  1. Axis Labels Rendering Quality
    By ChrisW67 in forum Qwt
    Replies: 0
    Last Post: 21st July 2009, 00:49
  2. Avoiding Truncated Labels
    By ChrisW67 in forum Qwt
    Replies: 5
    Last Post: 7th July 2009, 07:34
  3. Histogram axis labels as text
    By DKGear in forum Qwt
    Replies: 1
    Last Post: 30th December 2008, 08:54
  4. Relocating axis labels
    By malcom2073 in forum Qwt
    Replies: 0
    Last Post: 9th May 2008, 13:01
  5. Tick Labels for Slider
    By jcraig in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 17:21

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.