Click here to Skip to main content
15,917,176 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is it possible to draw a best fit line or curve through a set of points that have been plotted on a chart control? I have two series, one whose trend is a straight line, and one whose tren is an exponential curve. Can the RAdChart control calculate the best fit line for me? If not, does anyone know where I can find the code to calculate the line so I can plot it manually?
Posted
Comments
Olivier Levrey 17-Mar-11 11:48am    
I voted 1 because you already posted this question and received an answer. Don't post another question to get more answers, just edit the previous one.
http://www.codeproject.com/Questions/169705/how-to-draw-best-fitt-graph-in-csharp-net.aspx

1 solution

In a forum about Telerik's RadChart control I read that it doesn't do any regression (best fit) analysis. For a quick start and basic information please see here: http://en.wikipedia.org/wiki/Regression_analysis[^].
There are different algorithms for differents type of regression analysis:


  1. Linear: See this CP article: An Algorithm for Weighted Linear Regression[^]
  2. Polynomial: http://en.wikipedia.org/wiki/Polynomial_regression[^]
  3. Non linear: http://en.wikipedia.org/wiki/Nonlinear_regression[^]


I've found a library also for C# here: http://www.extremeoptimization.com/StatsFeatures.aspx[^]. If you scroll down the page you'll find a comprehensive list of regression analysis methods that it implements. I didn't look yet at wether it's free or not. It looks promising though so placed the link here in case you want to take a look for yourself.

Best Regards,
 
Share this answer
 
v2
Comments
Albin Abel 17-Mar-11 13:33pm    
Yes, Wikipedia is the best place he can read something before copying any code. Polynomials can be solved by the simple Newton Rhapson optimization. Let him come up with that :). My 5
Manfred Rudolf Bihy 18-Mar-11 8:53am    
Thanks Albin!
Sandeep Mewara 17-Mar-11 14:23pm    
Good answer! my 5!!
Manfred Rudolf Bihy 18-Mar-11 8:53am    
I appreciate it. Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900