Results 1 to 5 of 5

Thread: Axis's minimum and maximum

  1. #1
    Join Date
    Jun 2008
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Axis's minimum and maximum

    Hello,
    I was wondering if it is possible to find minimum and maximum (lBound and hBound) of given axis.
    THe QwtPlot Documentation vaguely mentions about it:

    const QwtScaleDiv * QwtPlot::axisScaleDiv (int axisId ) const
    Return the scale division of a specified axis.
    axisScaleDiv(axisId)->lBound(), axisScaleDiv(axisId)->hBound() are the current limits of the axis scale.

    However, when I tried to use it, it always returned me 0 for lBound and hBound.
    Is there any other way to get minimum and maximum on a scale?

    If it is difficult to get minimum and maximum of a axis, I have modified my Qwt and implemented couple of methods in QwtPlot class:
    double axislBound(int axisId);
    double axishBound(int axisId);
    where axisId is the enum for axis and these functions return l or h bound of that axis or 0 if axisId is invalid.
    I would very much appreciate your help if there already exist a simple way to get these values, or if not, if this would be a good patch.
    Thanks,
    Pankaj

  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's minimum and maximum

    axisScaleDiv(...)->lBound()/hBound is the right way to get the axes limits. But note, that the QwtScaleDivs need to be calculated before you can access them. I guess you called the getters before the first replot().

    Uwe

  3. The following 2 users say thank you to Uwe for this useful post:

    Fractal (7th March 2012), pankaj.patil (11th June 2008)

  4. #3
    Join Date
    Jun 2008
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis's minimum and maximum

    Hi Uwe,
    I cant thank you more, it worked perfectly with replot();
    I am actually trying to resize the plot by dragging one of the canvas's border. I had created an invisible path on the top of canvas's border and upon certain events, I was resizing the graph to match the path. Wont calling replot() every time mouse is moved (while holding my invisible path) cause some not so smooth resizing of the plot? Would updateAxes() serve the purpose? Also, is there any way I can display the canvas's border with different color/thickness?
    I really appreciate your time and response.
    Thanks,
    Pankaj

  5. #4
    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's minimum and maximum

    a) When you resize the canvas and you want to adopt its content to the new size you need to call replot.
    b) QwtPlotCanvas is a QFrame.

    Uwe

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

    changanminglike (24th November 2011)

  7. #5
    Join Date
    Jun 2008
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis's minimum and maximum

    Thanks Uwe,
    -Pankaj

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.