Skip to main content

Trend Lines

  • 3 minutes to read

This topic outlines the fundamentals of Trend Lines and describes how to draw a trend line between any two series points.

The topic consists of the following sections.

Trend Lines Overview

A Trend Line is a line drawn between any two points in a series, to show the general direction in which values are headed. Trend Lines belong to the Indicators tool set included in the ASP.NET Chart Control, for extended visual data analysis.

Trend Lines are often used in business analytics to show changes in data over time, using simple and understandable visuals. However, they suffer from a lack of scientific validity in cases where other potential changes can affect the data. For some scenarios it may be more appropriate to use Regression Lines, which are more sophisticated analytical instrument. A Regression Line is an indicator that allows you to perform linear regression analysis over series points.

trendline_00

A Trend Line is represented by an instance of the TrendLine class, which is a descendant of the Indicator class. Trend Lines reside in the IndicatorCollection of a series. Use the XYDiagram2DSeriesViewBase.Indicators property to access this collection.

The view type of the series to which a Trend Line is assigned is returned by the Indicator.View property.

A series can possess any number of Trend Lines. You can draw an unlimited number of these lines across the same series point.

Since a Trend Line must be drawn across two points, its two properties should be appropriately defined: FinancialIndicator.Point1 and FinancialIndicator.Point2. In turn, for each of these points you should define its argument (with the FinancialIndicatorPoint.Argument property) and value level (with the FinancialIndicatorPoint.ValueLevel property). For series view types that support only a single value, the FinancialIndicatorPoint.ValueLevel property has the Value setting only.

The TrendLine.ExtrapolateToInfinity property indicates whether the current Trend Line should be extrapolated beyond the end point’s argument, or limited to this point.

A Trend Line’s appearance is managed with its Indicator.Color and Indicator.LineStyle properties.

Draw a Trend Line

To access the collection of indicators for a series at design time:

  • invoke the Series Collection Editor by clicking the Series ellipsis button in the Properties window;

    ClickSeriesEllipsisButton

  • switch to the Properties tab in the Series Collection Editor, expand the SeriesBase.View property, and click the ellipsis button for the XYDiagram2DSeriesViewBase.Indicators property;

    ClickIndicatorsEllipsisButton

  • click the Add… button in the invoked Indicators dialog;

    IndicatorsEditor

  • select the Trend Line type, and click OK in the Indicator Type dialog.

    SelectTrendLineType

After a Trend Line is created, you can define its properties in the Indicators dialog: FinancialIndicator.Point1, FinancialIndicator.Point2 and other properties.

Note that all of the chart’s indicators are painted based on a palette defined by the WebChartControl.IndicatorsPaletteName property.

See Also