Results 1 to 5 of 5

Thread: Get the points of a fitted curve

  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Get the points of a fitted curve

    Is it possible to get the data point of a fitted curve?
    I have to use them to calculate the area of the curve.
    I use setCurveAttribute(QwtPlotCurve::Fitted,true);
    G

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

    Default Re: Get the points of a fitted curve

    The splines are calculated for the points after they have been translated into pixel positions. If you want to do the same in your application code translate the points using the canvas maps and use a QwtSplineCurveFitter. Then you can retranslate the calculated points with the maps.

    If all you want to do is to fill the area below the curve better use QwtPlotCurve::setBrush instead.

    Uwe

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

    Default Re: Get the points of a fitted curve

    Quote Originally Posted by Uwe View Post

    If all you want to do is to fill the area below the curve better use QwtPlotCurve::setBrush instead.

    Uwe
    Thank you, but I need them in order to compute the area. Is there any method in Qwt to compute the area under the curve (not just filling)?

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

    Default Re: Get the points of a fitted curve

    I have no idea how to get the data of the fitted curve
    I use the attribute "Fitted" in setCurveAttribute.
    Now, in order to compute the area I should have an array of values of the generated curve.
    I see in Qwt:

    canvasMap() which returns the map.
    And then?

  5. #5
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get the points of a fitted curve

    I tried the following code:
    (I have 12 curves called dSolar)
    Qt Code:
    1. c=(QwtSplineCurveFitter*)dSolar[11]->curveFitter();
    2.  
    3. s=c->spline();
    4. double inter = s.value(0);
    5. qDebug()<<"Data size="<<dSolar[11]->dataSize()<<s.value(0)<<s.value(180);
    To copy to clipboard, switch view to plain text mode 

    but I get alwasy zero values...

Similar Threads

  1. Replies: 5
    Last Post: 10th October 2008, 06:44
  2. Plotting part of a curve
    By viridis in forum Qwt
    Replies: 6
    Last Post: 21st July 2008, 08:12

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.