menu

MAUI Toolkit

  • User Guide
  • Demos
  • Support
Class ViewAnnotation - MAUI-ToolKit API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ViewAnnotation

    This class is used to add an view annotation in SfCartesianChart. An instance of this class need to be added to Annotations collection.

    Inheritance
    System.Object
    ChartAnnotation
    ViewAnnotation
    Inherited Members
    ChartAnnotation.CoordinateUnit
    ChartAnnotation.CoordinateUnitProperty
    ChartAnnotation.Draw(ICanvas, RectF)
    ChartAnnotation.IsVisible
    ChartAnnotation.IsVisibleProperty
    ChartAnnotation.X1
    ChartAnnotation.X1Property
    ChartAnnotation.XAxisName
    ChartAnnotation.XAxisNameProperty
    ChartAnnotation.Y1
    ChartAnnotation.Y1Property
    ChartAnnotation.YAxisName
    ChartAnnotation.YAxisNameProperty
    Namespace: Syncfusion.Maui.Toolkit.Charts
    Assembly: Syncfusion.Maui.Toolkit.dll
    Syntax
    public class ViewAnnotation : ChartAnnotation
    Remarks

    ViewAnnotation is used to add any custom shape or custom view over the chart area.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart.Annotations>
      <chart:ViewAnnotation X1="3" Y1="10">
        <chart:ViewAnnotation.View>
            <Label Text = "ViewAnnotation"/>
        </chart:ViewAnnotation.View>
      </chart:ViewAnnotation>
    </chart:SfCartesianChart.Annotations>  
    SfCartesianChart chart = new SfCartesianChart();
    var view = new ViewAnnotation()
    {
      X1 = 3,
      Y1 = 10,  
    };
    var label = new Label()
    {
       Text = "ViewAnnotation",
    };
    
    view.View = label;
    
    chart.Annotations.Add(view);

    Constructors

    ViewAnnotation()

    Declaration
    public ViewAnnotation()

    Fields

    HorizontalAlignmentProperty

    Identifies the HorizontalAlignment bindable property.

    Declaration
    public static readonly BindableProperty HorizontalAlignmentProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    The HorizontalAlignment property specifies how the custom view is horizontally aligned within the chart.

    VerticalAlignmentProperty

    Identifies the VerticalAlignment bindable property.

    Declaration
    public static readonly BindableProperty VerticalAlignmentProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    The VerticalAlignment property specifies how the custom view is vertically aligned within the chart.

    ViewProperty

    Identifies the View bindable property.

    Declaration
    public static readonly BindableProperty ViewProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    The View property defines the custom view to be displayed within the ViewAnnotation.

    Properties

    HorizontalAlignment

    Gets or sets the horizontal alignment of the view.

    Declaration
    public ChartAlignment HorizontalAlignment { get; set; }
    Property Value
    Type Description
    ChartAlignment

    This property takes the ChartAlignment as its value and its default value is Center.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart.Annotations>
      <chart:ViewAnnotation X1="3" Y1="10" HorizontalAlignment="Start">
        <chart:ViewAnnotation.View>
            <Label Text = "ViewAnnotation"/>
        </chart:ViewAnnotation.View>
      </chart:ViewAnnotation>
    </chart:SfCartesianChart.Annotations>  
    SfCartesianChart chart = new SfCartesianChart();
    var view = new ViewAnnotation()
    {
      X1 = 3,
      Y1 = 10,  
      HorizontalAlignment = ChartAlignment.Start,
    };
    var label = new Label()
    {
       Text = "ViewAnnotation",
    };
    
    view.View = label;
    
    chart.Annotations.Add(view);

    VerticalAlignment

    Gets or sets the vertical alignment of the view.

    Declaration
    public ChartAlignment VerticalAlignment { get; set; }
    Property Value
    Type Description
    ChartAlignment

    This property takes the ChartAlignment as its value and its default value is Center.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart.Annotations>
      <chart:ViewAnnotation X1="3" Y1="10" VerticalAlignment="Start">
        <chart:ViewAnnotation.View>
            <Label Text = "ViewAnnotation"/>
        </chart:ViewAnnotation.View>
      </chart:ViewAnnotation>
    </chart:SfCartesianChart.Annotations>  
    SfCartesianChart chart = new SfCartesianChart();
    var view = new ViewAnnotation()
    {
      X1 = 3,
      Y1 = 10,  
      VerticalAlignment = ChartAlignment.Start,
    };
    var label = new Label()
    {
       Text = "ViewAnnotation",
    };
    
    view.View = label;
    
    chart.Annotations.Add(view);

    View

    Gets or sets the View that represents custom view for annotation

    Declaration
    public View View { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.View

    This property takes the Microsoft.Maui.Controls.View as its value and its default value is null

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart.Annotations>
      <chart:ViewAnnotation X1="3" Y1="10">
        <chart:ViewAnnotation.View>
            <Label Text = "ViewAnnotation"/>
        </chart:ViewAnnotation.View>
      </chart:ViewAnnotation>
    </chart:SfCartesianChart.Annotations>  
    SfCartesianChart chart = new SfCartesianChart();
    var view = new ViewAnnotation()
    {
      X1 = 3,
      Y1 = 10,  
    };
    var label = new Label()
    {
       Text = "ViewAnnotation",
    };
    
    view.View = label;
    
    chart.Annotations.Add(view);
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved