Class PyramidDataLabelSettings

    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.RotationProperty
    ChartDataLabelSettings.BackgroundProperty
    ChartDataLabelSettings.BorderThicknessProperty
    ChartDataLabelSettings.BorderBrushProperty
    ChartDataLabelSettings.MarginProperty
    ChartDataLabelSettings.FontStyleProperty
    ChartDataLabelSettings.FontSizeProperty
    ChartDataLabelSettings.ForegroundProperty
    ChartDataLabelSettings.UseSeriesPaletteProperty
    ChartDataLabelSettings.HighlightOnSelectionProperty
    ChartDataLabelSettings.HorizontalAlignmentProperty
    ChartDataLabelSettings.VerticalAlignmentProperty
    ChartDataLabelSettings.ConnectorHeightProperty
    ChartDataLabelSettings.ConnectorRotationProperty
    ChartDataLabelSettings.ConnectorLineStyleProperty
    ChartDataLabelSettings.ContentTemplateProperty
    ChartDataLabelSettings.FontFamilyProperty
    ChartDataLabelSettings.ContextProperty
    ChartDataLabelSettings.FormatProperty
    ChartDataLabelSettings.Rotation
    ChartDataLabelSettings.Background
    ChartDataLabelSettings.BorderThickness
    ChartDataLabelSettings.BorderBrush
    ChartDataLabelSettings.Margin
    ChartDataLabelSettings.FontStyle
    ChartDataLabelSettings.FontSize
    ChartDataLabelSettings.Foreground
    ChartDataLabelSettings.UseSeriesPalette
    ChartDataLabelSettings.HighlightOnSelection
    ChartDataLabelSettings.HorizontalAlignment
    ChartDataLabelSettings.VerticalAlignment
    ChartDataLabelSettings.ConnectorHeight
    ChartDataLabelSettings.ConnectorRotation
    ChartDataLabelSettings.ConnectorLineStyle
    ChartDataLabelSettings.ShowConnectorLine
    ChartDataLabelSettings.ContentTemplate
    ChartDataLabelSettings.FontFamily
    ChartDataLabelSettings.Series
    ChartDataLabelSettings.Context
    ChartDataLabelSettings.Format
    Namespace: Syncfusion.UI.Xaml.Charts
    Assembly: Syncfusion.Chart.WinUI.dll
    Syntax
    public sealed class PyramidDataLabelSettings : ChartDataLabelSettings
    Remarks

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

    ShowDataLabels

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

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

    ContentTemplate

    The appearance of the data label can be customized using the ContentTemplate property of PyramidDataLabelSettings.

    • Xaml
       <chart:SfPyramidChart ItemsSource ="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue"
                             ShowDataLabels="True">
    
               <chart:SfPyramidChart.DataLabelSettings>
                   <chart:PyramidDataLabelSettings>
                       <chart:PyramidDataLabelSettings.ContentTemplate>
                           <DataTemplate>
                              <StackPanel Margin = "10" Orientation="Vertical">
                                   <Ellipse Height = "15" Width="15" Fill="Cyan" 
                                            Stroke="#4a4a4a" StrokeThickness="2"/>
                                   <TextBlock HorizontalAlignment = "Center" FontSize="12"
                                              Foreground="Black" FontWeight="SemiBold"
                                              Text="{Binding}"/>
                              </StackPanel>
                           </DataTemplate>
                       </chart:PyramidDataLabelSettings.ContentTemplate>
                   </chart:PyramidDataLabelSettings>
               </chart:SfPyramidChart.DataLabelSettings>
       </chart:SfPyramidChart>

    Context

    To customize the content of data labels, it offers Context property.

    • Xaml
    • C#
       <chart:SfPyramidChart ItemsSource ="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue"
                             ShowDataLabels="True">
             <chart:SfPyramidChart.DataLabelSettings>
                 <chart:PyramidDataLabelSettings Context="Percentage" />
             </chart:SfPyramidChart.DataLabelSettings>
       </chart:SfPyramidChart>
        ViewModel viewModel = new ViewModel();
    
        SfPyramidChart chart = new SfPyramidChart()
        {
           ItemsSource = viewModel.Data,
           XBindingPath = "XValue",
           YBindingPath = "YValue",
           ShowDataLabels = true
        };
    
        chart.DataLabelSettings = new PyramidDataLabelSettings()
        {
            Context = LabelContext.Percentage,
        };

    Customization

    To change the appearance of data labels, it offers BorderBrush, BorderThickness, Margin, Foreground, Background, FontStyle, FontSize, and FontFamily options.

    • Xaml
    • C#
       <chart:SfPyramidChart ItemsSource ="{Binding Data}" 
                             XBindingPath="XValue"
                             YBindingPath="YValue"
                             ShowDataLabels="True">
             <chart:SfPyramidChart.DataLabelSettings>
                 <chart:PyramidDataLabelSettings Foreground="White" FontSize="11" 
                                                 FontFamily="Calibri" BorderBrush="Black" BorderThickness="1" Margin="1" 
                                                 FontStyle="Italic" Background="#1E88E5" />
             </chart:SfPyramidChart.DataLabelSettings>
       </chart:SfPyramidChart>
        ViewModel viewModel = new ViewModel();
    
        SfPyramidChart chart = new SfPyramidChart()
        {
           ItemsSource = viewModel.Data,
           XBindingPath = "XValue",
           YBindingPath = "YValue",
           ShowDataLabels = true,
        };
    
        chart.DataLabelSettings = new PyramidDataLabelSettings()
        {
            Foreground = new SolidColorBrush(Colors.White),
            BorderBrush = new SolidColorBrush(Colors.Black),
            Background = new SolidColorBrush(Color.FromArgb(255, 30, 136, 229)),
            BorderThickness = new Thickness(1),
            Margin = new Thickness(1),
            FontStyle = FontStyle.Italic,
            FontFamily = new FontFamily("Calibri"),
            FontSize = 11,
        };

    Constructors

    PyramidDataLabelSettings()

    Initializes a new instance of the PyramidDataLabelSettings class.

    Declaration
    public PyramidDataLabelSettings()
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved