Results 1 to 3 of 3

Thread: Retrieve Curve values

  1. #1
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Unhappy Retrieve Curve values

    HI all,

    I have several QwtPlotCurve objects and a QwtPlotPicker object on my graph, QwtPlotPicker send the x,y value inside the canvas where I click , and I would like to know if there is a way to retrieve the real values of the curve using the values (coordinates x,y ) send by QwtPlotPicker object.

    look at the picture attached, when I click inside the canvas I need to display next to each curve the value where the mark intersect the curve.

    If someone had done something like this I really appreciate any help.
    Attached Images Attached Images

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

    Default Re: Retrieve Curve values

    Use QwtPlotCurve::closestPoint() to find the next point. The rest should be school mathematics.

    Note that the implementation of QwtPlotCurve::closestPoint iterates over all points and is slow for many points. You might get faster lookups by implementing your own algo, f.e binary search for points with increasing/decreasing x-values or using a quadtree ...

    Uwe

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

    nenukino (28th January 2008), solareclectic (30th January 2008)

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

    Exclamation Re: Retrieve Curve values

    Hello! Nenukino,
    Even i am planning to get the co-ordinates of the curve whenever i click on it. As you said in your post thath: -
    Quote Originally Posted by nenukino View Post
    I have several QwtPlotCurve objects and a QwtPlotPicker object on my graph, QwtPlotPicker send the x,y value inside the canvas where I click.
    Can you please let me know how do i get that like do i have to use: -
    "QwtText QwtPlotPicker::trackerText(const QPoint & pos)const"
    OR
    "QPoint QwtPlotPicker::transform(const QwtDoublePoint & pos)const"
    And how to give the parameter 'pos' to the 1st option?

    I will be obliged if helped with proper syntax & arguments.-----> Thanks in advance.

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.