View Full Version : Get the points of a fitted curve

giusepped

17th December 2008, 06:05

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

Uwe

17th December 2008, 06:50

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

giusepped

17th December 2008, 07:01

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)?

giusepped

24th December 2008, 09:16

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?

giusepped

25th December 2008, 07:42

I tried the following code:

(I have 12 curves called dSolar)

QwtSplineCurveFitter *c;

QwtSpline s;

c=(QwtSplineCurveFitter*)dSolar[11]->curveFitter();

s=c->spline();

double inter = s.value(0);

qDebug()<<"Data size="<<dSolar[11]->dataSize()<<s.value(0)<<s.value(180);

but I get alwasy zero values...

Powered by vBulletin® Version 4.2.5 Copyright © 2019 vBulletin Solutions Inc. All rights reserved.