Class ShapeAnnotation
ShapeAnnotation allows you to add annotations in the form of shapes such as rectangles, ellipses, lines, horizontal lines, and vertical lines at specific areas of interest within the chart area.
Inheritance
Inherited Members
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.dll
Syntax
public abstract class ShapeAnnotation : ChartAnnotation, IThemeElement
Constructors
ShapeAnnotation()
Declaration
public ShapeAnnotation()
Fields
FillProperty
Identifies the Fill bindable property.
Declaration
public static readonly BindableProperty FillProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Fill bindable property. |
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for LabelStyle bindable property. |
StrokeDashArrayProperty
Identifies the StrokeDashArray bindable property.
Declaration
public static readonly BindableProperty StrokeDashArrayProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for StrokeDashArray bindable property. |
StrokeProperty
Identifies the Stroke bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Stroke bindable property. |
StrokeWidthProperty
Identifies the StrokeWidth bindable property.
Declaration
public static readonly BindableProperty StrokeWidthProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for StrokeWidth bindable property. |
TextProperty
Identifies the Text bindable property.
Declaration
public static readonly BindableProperty TextProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Text bindable property. |
X2Property
Identifies the X2 bindable property.
Declaration
public static readonly BindableProperty X2Property
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for X2 bindable property. |
Y2Property
Identifies the Y2 bindable property.
Declaration
public static readonly BindableProperty Y2Property
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Y2 bindable property. |
Properties
Fill
Gets or sets the fill color of the shape annotation.
Declaration
public Brush Fill { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | This property takes the Microsoft.Maui.Controls.Brush as its value. |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:RectangleAnnotation X1="1" Y1="10" X2="4" Y2="20" Fill="Green"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
LabelStyle
Get or set the value to customize the appearance of shape 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:HorizontalLineAnnotation X1="1" Y1="10" X2="4" Y2="20">
<chart:HorizontalLineAnnotation.LabelStyle>
<chart:ChartAnnotationLabelStyle HorizontalTextAlignment="Start" VerticalTextAlignment="Start"/>
</chart:HorizontalLineAnnotation.LabelStyle>
</chart:HorizontalLineAnnotation>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Stroke
Gets or sets the stroke for the annotation.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | This property takes the Microsoft.Maui.Controls.Brush as its value. |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:VerticalLineAnnotation X1="1" Y1="10" Stroke="Red"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
StrokeDashArray
Gets or sets a value to customize the appearance of the annotation border.
Declaration
public DoubleCollection StrokeDashArray { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DoubleCollection | This property takes the Microsoft.Maui.Controls.DoubleCollection as its value and its default value is null |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:VerticalLineAnnotation X1="1" Y1="10" StrokeDashArray="5,3"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
StrokeWidth
Gets or sets a value that indicates the width of the annotations stroke.
Declaration
public double StrokeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | This property takes the |
Remarks
The value needs to be greater than zero.
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:VerticalLineAnnotation X1="1" Y1="10" StrokeWidth="5"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Text
Gets or sets the string value that represents 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:HorizontalLineAnnotation Y1="10" Text="Text"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
X2
Gets or sets the DateTime or double value that represents the x2 position of the annotation.
Declaration
public object X2 { get; set; }
Property Value
Type | Description |
---|---|
System.Object | This property takes the |
Examples
<chart:SfCartesianChart.Annotations>
<chart:RectangleAnnotation X1="3" Y1="20" X2="4" Y2="40">
</chart:RectangleAnnotation>
</chart:SfCartesianChart.Annotations>
Y2
Gets or sets the double value that represents the y2 position of the annotation.
Declaration
public double Y2 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | This property takes the |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:SfCartesianChart.Annotations>
<chart:LineAnnotation X1="1" Y1="10" X2="4" Y2="20"/>
</chart:SfCartesianChart.Annotations>
</chart:SfCartesianChart>
Methods
Draw(ICanvas, RectF)
Declaration
protected override void Draw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.RectF | dirtyRect |
Overrides
OnBindingContextChanged()
Declaration
protected override void OnBindingContextChanged()
OnParentSet()
Declaration
protected override void OnParentSet()