Regression Lines
- 3 minutes to read
This document describes how a linear regression analysis can be performed over your chart's visual data. DXCharts introduces the Regression Line to accomplish this.
The document consists of the following sections.
#Regression Lines Overview
A Regression Line is a line representing a linear regression analysis, available for series view types that support the XY-Diagram.
A Regression Line differs from a Trend Lines in that it is a straight line indicating whether a particular data set has increased or decreased over a period of time. Trend Lines are sometimes used in business analytics to show changes in data over time because they are simple. However, they suffer from a lack of scientific validity in cases where other potential changes can affect the data. Thus, regression lines are a more sophisticated analytical instrument.
Regression Lines determine whether the data suggests some kind of simple function between its variables. (In general, there are one or more independent variables and a single dependent variable, the values of which depend on the values of the other variables.) Linear regression analysis involves determining the underlying equation through a method called least squares. This method minimizes the error terms depending on how far away each data point is from the underlying linear function. Thus, the method minimizes the sum of the squares of the errors.
A Regression Line is represented by an instance of the RegressionLine class (which is a descendant of the Indicator class) and (along with other indicators) resides in the IndicatorCollection of a series returned by the XYSeries2D.Indicators property.
A series can possess any number of Regression Lines and any number of them can be drawn across the same value level.
The table below lists the main properties that affect the element's functionality and appearance.
Class | The Regression |
Availability | |
Specific Options | |
Appearance | Chart |
Visibility and Legend Availability | Indicator. |
#Draw a Regression Line
To access the collection of indicators for a series at design time, select the series (e.g. StockSeries2D) and click the ellipsis button for the XYSeries2D.Indicators property in the Properties window.
In the invoked Indicator Collection Editor: Indicators dialog, select Regression Line and click the Add button.
After a Regression Line is created, you can define its properties in the Indicator Collection Editor: Indicators dialog.
Specify the value of a regression line's point using the RegressionLine.ValueLevel property, as shown in the image above.
Click the OK button to close the Indicators dialog.
Note that all of the chart's indicators are painted based on a palette defined via the ChartControl.IndicatorsPalette property.