Back to Devexpress

Trend Lines

wpf-14327-controls-and-libraries-charts-suite-chart-control-series-indicators-simple-indicators-trend-lines.md

latest4.5 KB
Original Source

Trend Lines

  • Sep 22, 2022
  • 2 minutes to read

A Trend Line is an indicator presented by a line drawn through two data points of a series.

How to Add a Trend Line to a Chart

The following markup shows how to add two trend lines to a chart:

xaml
<dxc:StockSeries2D.Indicators>
    <dxc:TrendLine x:Name="trendLine1"
                Argument1="6/26/2016"
                ValueLevel1="High"
                Argument2="7/31/2016"
                ValueLevel2="High"
                ExtrapolateToInfinity="False"
                LegendText="Resistance Trend Line"
                ShowInLegend="True"/>
    <dxc:TrendLine x:Name="trendLine2"
                Argument1="6/1/2016"
                ValueLevel1="Low"
                Argument2="6/26/2016"
                ValueLevel2="Low"                 
                LegendText="Support Trend Line"
                ShowInLegend="True"/>
</dxc:StockSeries2D.Indicators>

The table lists classes and properties required to draw trend lines:

Class or PropertyDescription
XYSeries2D.IndicatorsProvides access to the collection of indicators that belong to the current series.
TrendLineRepresents an individual Trend Line.
FinancialIndicator.Argument1Gets or sets an argument of the first financial indicator’s point.
FinancialIndicator.ValueLevel1Gets or sets a value indicating how to obtain the first value of a financial indicator’s point.
FinancialIndicator.Argument2Gets or sets an argument of the second financial indicator’s point.
FinancialIndicator.ValueLevel2Gets or sets a value indicating how to obtain the second value of a financial indicator’s point.
TrendLine.ExtrapolateToInfinitySpecifies whether the Trend Line is extrapolated to infinity.
TrendLine.ExtrapolateToNegativeInfinitySpecifies whether the Trend Line is extrapolated to negative infinity.
Indicator.LegendTextGets or sets the text that identifies the indicator within the legend of a chart control.
Indicator.ShowInLegendSpecifies whether the indicator (Fibonacci Indicators, Regression Lines, Moving Average and Envelope or Trend Lines) is represented in the chart’s legend.

Tip

Set the Indicator.Visible property to false when you need to hide a trend line on a chart without its removal from the Indicators collection.

Note

To learn more about the common indicator settings, examine the Indicators help document.

See Also

Regression Lines

Fibonacci Indicators

Moving Average and Envelope