Telerik Product and Version
|Telerik UI for ASP.NET AJAX Q3 2014 SP1
Supported Browsers and Platforms
|All browsers and platforms supported by Telerik UI for ASP.NET AJAX
Components/Widgets used (JS frameworks, etc.)
This project showcases how to plot regression models (simple linear and logarithmic regression line) with RadHtmlChart
. The example uses the ordinary least squares method
for calculating the estimates of a and b parameters and also provides a calculation for the r-squared
coefficient of determination.
All of the calculations are done twice - once in MS Excel, to get a better understanding of the corresponding formulae and second in .NET, to integrate it with the Telerik's chart for ASP.NET.
You can find a detailed information on the matter in the How to Plot a Simple Linear Regression in Telerik ASP.NET Web Form Chart
How to Plot a Regression Model with RadHtmlChart
- Download the code example.
- Place the RegressionModels.cs file in the App_Code folder of your web app/site.
- Include the RegressionModels namespace in the code behind logic of your page.
- Call the CreateRegressionModel.Plot method and pass the required parameters:
- HtmlChart - The RadHtmlChart instance.
- DataSource - The DataTable data source.
- DataFieldX - The name of the column in the data source that stores the x-values.
- DataFieldY - The name of the column in the data source that stores the y-values.
- RegressionModelType - The type of the regression model.
You can review the project attached at the bottom of this article for additional reference.