Class ChartAnnotation
Serves as a base class for all types of annotations such as text, shape, and view. The annotations can be added to the chart.
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public abstract class ChartAnnotation : Element
Constructors
ChartAnnotation()
Initializes a new instance of the ChartAnnotation.
Declaration
public ChartAnnotation()
Fields
CoordinateUnitProperty
Identifies the CoordinateUnit bindable property.
Declaration
public static readonly BindableProperty CoordinateUnitProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The CoordinateUnit property defines whether the annotation coordinates are based on axis units or pixel units.
IsVisibleProperty
Identifies the IsVisible bindable property.
Declaration
public static readonly BindableProperty IsVisibleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The IsVisible property determines annotation visibility in the SfCartesianChart.
X1Property
Identifies the X1 bindable property.
Declaration
public static readonly BindableProperty X1Property
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The X1 property sets the X-coordinate for the annotation.
XAxisNameProperty
Identifies the XAxisName bindable property.
Declaration
public static readonly BindableProperty XAxisNameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The XAxisName property specifies the X-axis to which the annotation is tied.
Y1Property
Identifies the Y1 bindable property.
Declaration
public static readonly BindableProperty Y1Property
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The Y1 property sets the Y-coordinate for the annotation.
YAxisNameProperty
Identifies the YAxisName bindable property.
Declaration
public static readonly BindableProperty YAxisNameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The YAxisName property specifies the Y-axis to which the annotation is tied.
Properties
CoordinateUnit
Gets or sets the property that identifies whether the annotation is positioned based on pixel or axis coordinates.
Declaration
public ChartCoordinateUnit CoordinateUnit { get; set; }
Property Value
Type | Description |
---|---|
ChartCoordinateUnit | This property takes the ChartCoordinateUnit as its value. Its default value is Axis. |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:LineAnnotation X1="0" Y1="10" X2="4" Y2="50" CoordinateUnit="Axis"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
IsVisible
Gets or sets a value that indicates whether the annotation is visible or not.
Declaration
public bool IsVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:VerticalLineAnnotation X1="1" IsVisible="True"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
X1
Gets or sets the DateTime or double that represents the x1 position of the chart annotation.
Declaration
public object X1 { get; set; }
Property Value
Type | Description |
---|---|
System.Object | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:VerticalLineAnnotation X1="1"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
XAxisName
Get or set the value of a string that represents the name of the x-axis in the annotation.
Declaration
public string XAxisName { get; set; }
Property Value
Type | Description |
---|---|
System.String | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:LineAnnotation X1="0" Y1="10" X2="4" Y2="50" LineCap="Arrow" XAxisName="xAxis"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Y1
Gets or sets the double that represents the y1 position of the chart annotation.
Declaration
public double Y1 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:HorizontalLineAnnotation Y1="10"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
YAxisName
Get or set the value of a string that represents the name of the y-axis in the annotation.
Declaration
public string YAxisName { get; set; }
Property Value
Type | Description |
---|---|
System.String | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:LineAnnotation X1="0" Y1="10" X2="4" Y2="50" LineCap="Arrow" YAxisName="yAxis"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Methods
Draw(ICanvas, RectF)
Draws the annotation of the chart.
Declaration
protected virtual void Draw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.RectF | dirtyRect |