Skip to main content
A newer version of this page is available. .

How to: Show a Regression Line for a Stock Chart

This tutorial demonstrates how linear regression analysis can be applied to a chart’s visual data at design time. For general information, see Regression Lines.

To show a Regression Line for a Stock chart follow the steps below.

  1. Create a new or open an existing Stock chart. For this example we will use the following chart.

    HowTo_ShowRegressionLine_0

  2. Select the series in the Property Grid, expand its SeriesBase.View property and click the ellipsis button for the XYDiagram2DSeriesViewBase.Indicators property.

    In the invoked Indicators dialog, click the Add… button.

    HowTo_ShowRegressionLine_1

  3. Then, in the Indicator Type dialog, choose Regression Line and click OK.

    HowTo_ShowRegressionLine_2

  4. Now, back in the Indicators dialog, you can specify the Regression Line’s SingleLevelIndicator.ValueLevel and other options.

    HowTo_ShowRegressionLine_3

The result is shown in the following image.

HowTo_ShowRegressionLine_4

Note that as with other indicators, all Regression Lines that exist in a chart are painted based on the palette defined via the ChartControl.IndicatorsPaletteName property.

See Also