Plot Regression Models with RadHtmlChart

Thread is closed for posting
1 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 06 Feb 2015 Link to this post


    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 blog post.

    How to Plot a Regression Model with RadHtmlChart
    1. Download the code example.
    2. Place the RegressionModels.cs file in the App_Code folder of your web app/site.
    3. Include the RegressionModels namespace in the code behind logic of your page.
    4. Call the CreateRegressionModel.Plot method and pass the required parameters:
      1. HtmlChart - The RadHtmlChart instance.
      2. DataSource - The DataTable data source.
      3. DataFieldX - The name of the column in the data source that stores the x-values.
      4. DataFieldY - The name of the column in the data source that stores the y-values.
      5. RegressionModelType - The type of the regression model.

    You can review the project attached at the bottom of this article for additional reference.

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.