menu

MAUI Toolkit

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

    Show / Hide Table of Contents

    Class ChartAnnotationLabelStyle

    Represents properties for customizing annotation labels.

    Inheritance
    System.Object
    ChartLabelStyle
    ChartAnnotationLabelStyle
    Inherited Members
    ChartLabelStyle.Background
    ChartLabelStyle.BackgroundProperty
    ChartLabelStyle.CornerRadius
    ChartLabelStyle.CornerRadiusProperty
    ChartLabelStyle.FontAttributes
    ChartLabelStyle.FontAttributesProperty
    ChartLabelStyle.FontFamily
    ChartLabelStyle.FontFamilyProperty
    ChartLabelStyle.FontSize
    ChartLabelStyle.FontSizeProperty
    ChartLabelStyle.LabelFormat
    ChartLabelStyle.LabelFormatProperty
    ChartLabelStyle.Margin
    ChartLabelStyle.MarginProperty
    ChartLabelStyle.Stroke
    ChartLabelStyle.StrokeProperty
    ChartLabelStyle.StrokeWidth
    ChartLabelStyle.StrokeWidthProperty
    ChartLabelStyle.TextColor
    ChartLabelStyle.TextColorProperty
    Namespace: Syncfusion.Maui.Toolkit.Charts
    Assembly: Syncfusion.Maui.Toolkit.dll
    Syntax
    public class ChartAnnotationLabelStyle : ChartLabelStyle, ITextElement, IThemeElement
    Remarks

    This class provides options to customize the appearance of annotation labels.

    HorizontalAlignment - Specifies the horizontal alignment of the annotation label. Refer to the HorizontalTextAlignment property for details.

    VerticalAlignment - Specifies the vertical alignment of the annotation label. Refer to the VerticalTextAlignment property for details.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
        <chart:SfCartesianChart.Annotations>
             <chart:TextAnnotation X1="3" Y1="30" Text="TextAnnotation">
              <chart:TextAnnotation.LabelStyle>
                <chart:ChartAnnotationLabelStyle VerticalTextAlignment="Start"/>
              </chart:TextAnnotation.LabelStyle>
             </chart:TextAnnotation>
        </chart:SfCartesianChart.Annotations>  
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();     
    
        // Eliminated for simplicity
        var text = new TextAnnotation()
        {
            X1 = 3,
            Y1 = 30,    
            Text = "TextAnnotation",
        };
    
     text.LabelStyle = new ChartAnnotationLabelStyle()
     {
        VerticalTextAlignment = ChartLabelAlignment.Start,
     };
    
    chart.Annotations.Add(text);

    Constructors

    ChartAnnotationLabelStyle()

    Initializes a new instance of the ChartAnnotationLabelStyle.

    Declaration
    public ChartAnnotationLabelStyle()

    Fields

    HorizontalTextAlignmentProperty

    Identifies the HorizontalTextAlignment bindable property.

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

    The identifier for the HorizontalTextAlignment bindable property determines the horizontal text alignment of the chart annotation.

    VerticalTextAlignmentProperty

    Identifies the VerticalTextAlignment bindable property.

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

    The identifier for the VerticalTextAlignment bindable property determines the vertical text alignment of the chart annotation.

    Properties

    HorizontalTextAlignment

    Gets or sets the horizontal text alignment of chart annotation.

    Declaration
    public ChartLabelAlignment HorizontalTextAlignment { get; set; }
    Property Value
    Type Description
    ChartLabelAlignment

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

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
        <chart:SfCartesianChart.Annotations>
             <chart:TextAnnotation X1="3" Y1="30" Text="TextAnnotation">
              <chart:HorizontalLineAnnotation.LabelStyle>
                <chart:ChartAnnotationLabelStyle HorizontalTextAlignment="Start"/>
              </chart:HorizontalLineAnnotation.LabelStyle>
             </chart:HorizontalLineAnnotation>
        </chart:SfCartesianChart.Annotations>  
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();     
    
        // Eliminated for simplicity
        var text = new TextAnnotation()
        {
            X1 = 3,
            Y1 = 30,    
            Text = "TextAnnotation",
        };
    
     text.LabelStyle = new ChartAnnotationLabelStyle()
     {
        HorizontalTextAlignment = ChartLabelAlignment.Start,
     };
    
    chart.Annotations.Add(text);

    VerticalTextAlignment

    Gets or sets the vertical text alignment of chart annotation.

    Declaration
    public ChartLabelAlignment VerticalTextAlignment { get; set; }
    Property Value
    Type Description
    ChartLabelAlignment

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

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
        <!-- ... Eliminated for simplicity-->
        <chart:SfCartesianChart.Annotations>
             <chart:TextAnnotation X1="3" Y1="30" Text="TextAnnotation">
              <chart:HorizontalLineAnnotation.LabelStyle>
                <chart:ChartAnnotationLabelStyle VerticalTextAlignment="Start"/>
              </chart:HorizontalLineAnnotation.LabelStyle>
             </chart:HorizontalLineAnnotation>
        </chart:SfCartesianChart.Annotations>  
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();     
    
        // Eliminated for simplicity
        var text = new TextAnnotation()
        {
            X1 = 3,
            Y1 = 30,    
            Text = "TextAnnotation",
        };
    
     text.LabelStyle = new ChartAnnotationLabelStyle()
     {
        VerticalTextAlignment = ChartLabelAlignment.Start,
     };
    
    chart.Annotations.Add(text);
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved