menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PyramidDataLabelSettings - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PyramidDataLabelSettings

    The PyramidDataLabelSettings class is used to customize the appearance of pyramid chart data labels.

    Inheritance
    System.Object
    ChartDataLabelSettings
    PyramidDataLabelSettings
    Inherited Members
    ChartDataLabelSettings.LabelPlacement
    ChartDataLabelSettings.LabelPlacementProperty
    ChartDataLabelSettings.LabelStyle
    ChartDataLabelSettings.LabelStyleProperty
    ChartDataLabelSettings.OnBindingContextChanged()
    ChartDataLabelSettings.UseSeriesPalette
    ChartDataLabelSettings.UseSeriesPaletteProperty
    Namespace: Syncfusion.Maui.Charts
    Assembly: Syncfusion.Maui.Charts.dll
    Syntax
    public class PyramidDataLabelSettings : ChartDataLabelSettings, IPyramidDataLabelSettings
    Remarks

    To customize data labels, create an instance of the PyramidDataLabelSettings class, and set it to the DataLabelSettings property of the pyramid chart.

    ShowDataLabels

    Data labels can be added to a chart series by enabling the ShowDataLabels option.

    • Xaml
    • C#
       <chart:SfPyramidChart ItemsSource ="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue"
                             ShowDataLabels="True"/>
    SfPyramidChart chart = new SfPyramidChart();
    ViewModel viewModel = new ViewModel();
    chart.ItemsSource = viewModel.Data;
    chart.XBindingPath = "XValue";
    chart.YBindingPath = "YValue";
    chart.ShowDataLabels= true;
    
    this.Content = chart;

    Customization

    To change the appearance of data labels, it offers LabelStyle options.

    Null values are invalid for LabelStyle.

    • Xaml
    • C#
       <chart:SfPyramidChart ItemsSource ="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue"
                             ShowDataLabels="True">
           <chart:SfPyramidChart.DataLabelSettings>
               <chart:PyramidDataLabelSettings>
                   <chart:PyramidDataLabelSettings.LabelStyle>
                       <chart:ChartDataLabelStyle Background = "Red" FontSize="14" TextColor="Black" />
                   </chart:PyramidDataLabelSettings.LabelStyle>
               </chart:PyramidDataLabelSettings>
           </chart:SfPyramidChart.DataLabelSettings>
       </chart:SfPyramidChart>
    SfPyramidChart chart = new SfPyramidChart();
    ViewModel viewModel = new ViewModel();
    chart.ItemsSource = viewModel.Data;
    chart.XBindingPath = "XValue";
    chart.YBindingPath = "YValue";
    chart.ShowDataLabels= true;
    
    var labelStyle = new ChartDataLabelStyle()
    {
        Background = new SolidColorBrush(Colors.Red),
        TextColor = Colors.Black,
        FontSize = 14,
    };
    
    chart.DataLabelSettings = new PyramidDataLabelSettings()
    {
        LabelStyle = labelStyle,
    };
    
    this.Content = chart;

    Constructors

    PyramidDataLabelSettings()

    Initializes a new instance of the PyramidDataLabelSettings.

    Declaration
    public PyramidDataLabelSettings()

    Fields

    ContextProperty

    Identifies the Context bindable property.

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

    Properties

    Context

    Gets or sets an option that determines the content to be displayed in the data labels.

    Declaration
    public PyramidDataLabelContext Context { get; set; }
    Property Value
    Type Description
    PyramidDataLabelContext

    Its default value is YValue.

    Examples
    • Xaml
    • C#
       <chart:SfPyramidChart ItemsSource ="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue"
                             ShowDataLabels="True">
           <chart:SfPyramidChart.DataLabelSettings>
               <chart:PyramidDataLabelSettings Context="XValue"/>
           </chart:SfPyramidChart.DataLabelSettings>
       </chart:SfPyramidChart>
    SfPyramidChart chart = new SfPyramidChart();
    ViewModel viewModel = new ViewModel();
    chart.ItemsSource = viewModel.Data;
    chart.XBindingPath = "XValue";
    chart.YBindingPath = "YValue";
    chart.ShowDataLabels= true;
    
    chart.DataLabelSettings = new PyramidDataLabelSettings()
    {
        Context = PyramidDataLabelContext.XValue
    };
    
    this.Content = chart;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved