How to use TCurveFittingFunction properties at runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

How to use TCurveFittingFunction properties at runtime

Post by bamboo » Fri Jun 20, 2008 7:19 am

I am creating a TCurvFittingFunction at runtime.
I wish to set the properties such as FirstPoint, Endpoint and PolyDegree.

How do I do it.

I used the following code.

Code: Select all

tmpPointSeries1:=TPointSeries.Create(self);
  AddSeries(tmpPointSeries1);

  //Populate them with data (here random)
  tmpPointSeries1.FillSampleValues(50);

  //Add a series to be used for an CurveFitting Function
  tmpLineSeries:=TLineSeries.Create(self);
  AddSeries(tmpLineSeries);

  //Define the Function Type for the new Series
  tmpLineSeries.SetFunction(TCurveFittingFunction.Create(self));

  //Define the Datasource for the new Function Series
  tmpLineSeries.DataSources.Clear;
  tmpLineSeries.DataSources.Add(tmpPointSeries1 );

  //tmpLineSeries.FunctionType.PolyDegree := 2; gives error message
Please advise. Thank you.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jun 20, 2008 8:17 am

Hi bamboo,

This is because you need to typecast series' function:

Code: Select all

    (tmpLineSeries.FunctionType as TCurveFittingFunction).PolyDegree := 2;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Fri Jun 20, 2008 8:41 am

Thank you.

Post Reply