Applying Functions to Teechart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Applying Functions to Teechart

Post by lilo » Thu Oct 06, 2011 2:49 am

I need to apply a function to a Points Series.

I have tried

PolyFitting1.PolyDegree = 2
Points1.Function = PolyFitting1
PolyFitting1.Calculate(Points1, 0, Numberofsamples)

This does not appear to be correct.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Applying Functions to Teechart

Post by Sandra » Thu Oct 06, 2011 9:41 am

Hello lilo,

I recommend you that take a look in the demo example All features\Welcome !\Functions\Extended\Polynomial fitting\Finding coefficients, where there is an example of you need to apply a Polynomial fitting function and I think, you can do something as do in the example. If you have any problems, please let me know.
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Re: Applying Functions to Teechart

Post by lilo » Sat Oct 15, 2011 5:22 am

Thanks Sandra,

I am using the example code but the coefficients keep returning 0.

PolyFitting1.PolyDegree = 2
Points1.DataSource = Points1
PolyFitting1.Chart = TChart1.Chart
Points1.Function = PolyFitting1
Points1.Function.Period = 2
Points1.CheckDataSource()
Points1.Function.Calculate(TChart1.Series(0), 0, NumofPoints - 1)
Dim t As Short
Dim txt = "y="
For t = 0 To PolyFitting1.PolyDegree - 1
txt += " "
If PolyFitting1.Coefficient(t) >= 0.0 Then txt += "+"
txt += PolyFitting1.Coefficient(t).ToString("0.00##")
If (t > 0) Then txt += "*x"
If (t > 1) Then txt += "^" + t.ToString()
Next

I am missing something in the code, but cannot figure out what it is?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Applying Functions to Teechart

Post by Sandra » Mon Oct 17, 2011 11:10 am

Hello lilo,

Can you try to arrange a simple project so we can reproduce your example exactly here and try to find where there is the problem?

Thanks,
Best Regards,
Sandra Pazos / 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

lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Re: Applying Functions to Teechart

Post by lilo » Mon Oct 17, 2011 11:19 am

Just a thought - I could add PolyFitting1.AddPoints method to the code.

What is the correct format for array Addpoints - there is no detailed reference in the documentation

Should I add an array of X Values or X and Y Values?

How should the Array be Declared?

Thanks,

lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Re: Applying Functions to Teechart

Post by lilo » Mon Oct 17, 2011 12:29 pm

Got the original code working. Just had to activate and relate the charts in the editor.

Thanks,

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Applying Functions to Teechart

Post by Sandra » Mon Oct 17, 2011 2:57 pm

Hi lilo,

I am glad that you have found the solution for your problem :).

Thanks,
Best Regards,
Sandra Pazos / 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

Post Reply