Results 1 to 5 of 5

Thread: Obtaining infos from magnified plot

  1. #1
    Join Date
    May 2009
    Posts
    75
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    5

    Question Obtaining infos from magnified plot

    I have QwtPlot and QwtPlotMagnifier. I can zoom only x axes. When I zoom in I can see only a portion of my curve. How can I obtain which portion of curve I see in the plot canvas? That is, xMin and xMax of the drowed portion?

    thanks

  2. #2
    Join Date
    May 2008
    Posts
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Default Re: Obtaining infos from magnified plot

    IIRC you can use invTransform(int axisID, int pos) on the QwtPlot to return the double value of the x-axis for start and finish.

    The plot goes from 1 to 1000 (int), so 1 will be xMin and 1000 will be xMax.

    I'm sure Uwe will be along to confirm shortly!

    Cheers

  3. #3
    Join Date
    May 2009
    Posts
    75
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    5

    Unhappy Re: Obtaining infos from magnified plot

    Quote Originally Posted by cnbp173 View Post
    The plot goes from 1 to 1000 (int), so 1 will be xMin and 1000 will be xMax.
    I tried with 1000 as xMax, but it seems that is incorrect...
    I tried using QwtScaleMap::transform(), applied with different windows size, and it seems thax xMax and xMin are pixel positions.
    So I don't think I can successfully use invTransform, because I don't know xMin and xMax.

    thanks
    Last edited by mastupristi; 9th July 2009 at 12:29. Reason: updated contents

  4. #4
    Join Date
    May 2008
    Posts
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Default Re: Obtaining infos from magnified plot

    The way I currently do it (although I'm a bit rusty) is to link the signal zoomed(const QwtDoubleRect &) to a function and then you can take the left() and right() of the resultant QwtDoubleRect to give the xMin and xMax.

    Not sure if this signal exists for the QwtMagnifier.

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: Obtaining infos from magnified plot

    a) All navigation operations (zooming, panning) ... finally end in a call of QwtPlot::setAxisScale() changing the scales of the scale widgets. Whenever a scale widget gets a new scale it emits QwtScaleWidget::scaleDivChanged(). With plot->axisScaleDiv() you can get the current scale divisions with all ticks and the left/right borders.

    b) With plot->canvas()->contentsRect() you find the area of the plot canvas in widget coordinates. With plot->canvasMap()->invTransform() you can translate it into plot coordinates.

    Uwe

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
  •  
Qt is a trademark of The Qt Company.