Class TextAnnotation
This class is used to add a text annotation to the SfCartesianChart. An instance of this class needs to be added to the Annotations collection.
Inherited Members
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class TextAnnotation : ChartAnnotation, IThemeElement
Remarks
Text annotations are used to add simple text at specific points over the chart area.
Examples
<chart:SfCartesianChart.Annotations>
<chart:TextAnnotation X1="3" Y1="10" Text="TextAnnotation">
</chart:TextAnnotation>
</chart:SfCartesianChart.Annotations>
Constructors
TextAnnotation()
Declaration
public TextAnnotation()
Fields
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The LabelStyle property allows to customize the appearance of the label associated with the TextAnnotation.
TextProperty
Identifies the Text bindable property.
Declaration
public static readonly BindableProperty TextProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The Text property defines the text content displayed by the TextAnnotation in the chart.
Properties
LabelStyle
Get or set the value to customize the appearance of annotation text.
Declaration
public ChartAnnotationLabelStyle LabelStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartAnnotationLabelStyle | This property takes the ChartAnnotationLabelStyle as its value. |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:TextAnnotation X1="3" Y1="30" Text="TextAnnotation">
<chart:TextAnnotation.LabelStyle>
<chart:ChartAnnotationLabelStyle HorizontalTextAlignment="Start" VerticalTextAlignment="Start"/>
</chart:TextAnnotation.LabelStyle>
</chart:TextAnnotation>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Text
Gets or sets the text to be displayed on the annotation.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:TextAnnotation X1="3" Y1="30" Text="TextAnnotation">
</chart:HorizontalLineAnnotation>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Methods
Draw(ICanvas, RectF)
Draws the annotation of the chart.
Declaration
protected override void Draw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.RectF | dirtyRect |