Class ChartTrendline
Represents the base abstract class for all trendline types in the chart.
Inheritance
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.dll
Syntax
public abstract class ChartTrendline : BindableObject, ITooltipDependent, IMarkerDependent, ICartesianLegendDependent
Constructors
ChartTrendline()
Initializes a new instance of the ChartTrendline class.
Declaration
public ChartTrendline()
Fields
BackwardForecastProperty
Identifies the BackwardForecast bindable property.
Declaration
public static readonly BindableProperty BackwardForecastProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
EnableTooltipProperty
Identifies the EnableTooltip bindable property.
Declaration
public static readonly BindableProperty EnableTooltipProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ForwardForecastProperty
Identifies the ForwardForecast bindable property.
Declaration
public static readonly BindableProperty ForwardForecastProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
IsVisibleProperty
Identifies the IsVisible bindable property.
Declaration
public static readonly BindableProperty IsVisibleProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
LabelProperty
Identifies the Label bindable property.
Declaration
public static readonly BindableProperty LabelProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
MarkerSettingsProperty
Identifies the MarkerSettings bindable property.
Declaration
public static readonly BindableProperty MarkerSettingsProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
OpacityProperty
Identifies the Opacity bindable property.
Declaration
public static readonly BindableProperty OpacityProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ShowMarkersProperty
Identifies the ShowMarkers bindable property.
Declaration
public static readonly BindableProperty ShowMarkersProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ShowTrackballLabelProperty
Identifies the ShowTrackballLabel bindable property.
Declaration
public static readonly BindableProperty ShowTrackballLabelProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
StrokeDashArrayProperty
Identifies the StrokeDashArray bindable property.
Declaration
public static readonly BindableProperty StrokeDashArrayProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
StrokeProperty
Identifies the Stroke bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
StrokeWidthProperty
Identifies the StrokeWidth bindable property.
Declaration
public static readonly BindableProperty StrokeWidthProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
TooltipTemplateProperty
Identifies the TooltipTemplate bindable property.
Declaration
public static readonly BindableProperty TooltipTemplateProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
TrackballLabelTemplateProperty
Identifies the TrackballLabelTemplate bindable property.
Declaration
public static readonly BindableProperty TrackballLabelTemplateProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Properties
BackwardForecast
Gets or sets the number of periods to forecast backward.
Declaration
public int BackwardForecast { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The default value is 0. |
EnableTooltip
Gets or sets a value indicating whether the tooltip for trendline should be shown or hidden.
Declaration
public bool EnableTooltip { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | It accepts bool values and its default value is |
Remarks
The trendline tooltip will appear when you click or tap the trendline area.
ForwardForecast
Gets or sets the number of periods to forecast forward.
Declaration
public int ForwardForecast { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The default value is 0. |
IsVisible
Gets or sets a value indicating whether the trendline is visible.
Declaration
public bool IsVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is true. |
Label
Gets or sets the label for the trendline.
Declaration
public string Label { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is null. |
MarkerSettings
Gets or sets the marker settings to customize the appearance of trendline markers.
Declaration
public ChartMarkerSettings MarkerSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartMarkerSettings | It accepts a ChartMarkerSettings instance. If null, default marker settings will be used. |
Remarks
This property allows customization of marker appearance including type, size, fill, stroke, and stroke width.
Markers are only displayed when ShowMarkers is set to true.
The marker settings follow the same pattern as series markers, supporting all standard marker shapes and styles.
Examples
<chart:LinearTrendline ShowMarkers="True">
<chart:LinearTrendline.MarkerSettings>
<chart:ChartMarkerSettings Type="Diamond" Fill="Blue" Stroke="DarkBlue" StrokeWidth="2" Width="10" Height="10" />
</chart:LinearTrendline.MarkerSettings>
</chart:LinearTrendline>
Opacity
Gets or sets the opacity of the trendline.
Declaration
public double Opacity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 1.0. |
ShowMarkers
Gets or sets a value indicating whether to show markers for the trendline data points.
Declaration
public bool ShowMarkers { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is |
Remarks
When enabled, markers will be displayed at calculated trendline points to highlight key positions along the trendline.
The marker appearance can be customized using the MarkerSettings property.
Markers support tooltip interaction when EnableTooltip is also enabled.
Examples
<chart:LinearTrendline ShowMarkers="True">
<chart:LinearTrendline.MarkerSettings>
<chart:ChartMarkerSettings Type="Circle" Fill="Red" Width="8" Height="8" />
</chart:LinearTrendline.MarkerSettings>
</chart:LinearTrendline>
ShowTrackballLabel
Gets or sets a value indicating whether to show trackball label for the trendline.
Declaration
public bool ShowTrackballLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | It accepts bool values and its default value is |
Remarks
The trendline trackball label will appear when trackball is activated and intersects with the trendline.
Stroke
Gets or sets the brush used to paint the trendline.
Declaration
public Brush Stroke { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.Brush | The default value is null. |
StrokeDashArray
Gets or sets the stroke dash pattern for the trendline.
Declaration
public DoubleCollection StrokeDashArray { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.DoubleCollection | The default value is null. |
StrokeWidth
Gets or sets the width of the trendline stroke.
Declaration
public double StrokeWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 2.0. |
TooltipTemplate
Gets or sets the DataTemplate that can be used to customize the appearance of the trendline tooltip.
Declaration
public DataTemplate TooltipTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.DataTemplate | It accepts a Microsoft.Maui.Controls.DataTemplate value. |
TrackballLabelTemplate
Gets or sets the DataTemplate that can be used to customize the appearance of the trendline trackball label.
Declaration
public DataTemplate TrackballLabelTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.DataTemplate | It accepts a Microsoft.Maui.Controls.DataTemplate value. |
Methods
OnBindingContextChanged()
Called when the binding context changes.
Declaration
protected override void OnBindingContextChanged()