menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ChartDataLabelMargin - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartDataLabelMargin

    Provides option to customize the margin of the data label.

    Inheritance
    System.Object
    ChartSubComponent
    ChartDefaultMargin
    ChartDataLabelMargin
    Namespace: Syncfusion.Blazor.Charts
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ChartDataLabelMargin : ChartDefaultMargin, ISubcomponentTracker

    Constructors

    ChartDataLabelMargin()

    Declaration
    public ChartDataLabelMargin()

    Properties

    Bottom

    Gets or sets the bottom margin of the data label in the SfChart.

    Declaration
    public override double Bottom { get; set; }
    Property Value
    Type Description
    System.Double

    A double representing the size of the bottom margin. The default value is 5.

    Overrides
    ChartDefaultMargin.Bottom
    Remarks

    This property allows customization of the space between the data label and the bottom edge of its boundary. It is particularly useful when the ChartDataLabelBorder is enabled.

    Examples
    // Example demonstrating how to set a custom bottom margin for a data label:
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@WeatherReports" XName="X" YName="Y">
                <ChartMarker>
                    <ChartDataLabel Visible="true">
                        <ChartDataLabelBorder Width="1" Color="black"></ChartDataLabelBorder>
                        <ChartDataLabelMargin Bottom="20"></ChartDataLabelMargin>
                    </ChartDataLabel>
                </ChartMarker>
            </ChartSeries>
        </ChartSeriesCollection>
    </SfChart>

    Left

    Gets or sets the left margin of the data label in the SfChart.

    Declaration
    public override double Left { get; set; }
    Property Value
    Type Description
    System.Double

    A double representing the size of the left margin. The default value is 5.

    Overrides
    ChartDefaultMargin.Left
    Remarks

    This property allows customization of the space between the data label and the left edge of its boundary. It is particularly useful when the ChartDataLabelBorder is enabled.

    Examples
    // Example demonstrating how to set a custom left margin for a data label:
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@WeatherReports" XName="X" YName="Y">
                <ChartMarker>
                    <ChartDataLabel Visible="true">
                        <ChartDataLabelBorder Width="1" Color="black"></ChartDataLabelBorder>
                        <ChartDataLabelMargin Left="20"></ChartDataLabelMargin>
                    </ChartDataLabel>
                </ChartMarker>
            </ChartSeries>
        </ChartSeriesCollection>
    </SfChart>

    Right

    Gets or sets the right margin of the data label in the SfChart.

    Declaration
    public override double Right { get; set; }
    Property Value
    Type Description
    System.Double

    A double representing the size of the right margin. The default value is 5.

    Overrides
    ChartDefaultMargin.Right
    Remarks

    This property allows customization of the space between the data label and the right edge of its boundary. It is particularly useful when the ChartDataLabelBorder is enabled.

    Examples
    // Example demonstrating how to set a custom right margin for a data label:
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@WeatherReports" XName="X" YName="Y">
                <ChartMarker>
                    <ChartDataLabel Visible="true">
                        <ChartDataLabelBorder Width="1" Color="black"></ChartDataLabelBorder>
                        <ChartDataLabelMargin Right="20"></ChartDataLabelMargin>
                    </ChartDataLabel>
                </ChartMarker>
            </ChartSeries>
        </ChartSeriesCollection>
    </SfChart>

    Top

    Gets or sets the top margin of the data label in the SfChart.

    Declaration
    public override double Top { get; set; }
    Property Value
    Type Description
    System.Double

    A double representing the size of the top margin. The default value is 5.

    Overrides
    ChartDefaultMargin.Top
    Remarks

    This property allows customization of the space between the data label and the top edge of its boundary. It is particularly useful when the ChartDataLabelBorder is enabled.

    Examples
    // Example demonstrating how to set a custom top margin for a data label:
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@WeatherReports" XName="X" YName="Y">
                <ChartMarker>
                    <ChartDataLabel Visible="true">
                        <ChartDataLabelBorder Width="1" Color="black"></ChartDataLabelBorder>
                        <ChartDataLabelMargin Top="20"></ChartDataLabelMargin>
                    </ChartDataLabel>
                </ChartMarker>
            </ChartSeries>
        </ChartSeriesCollection>
    </SfChart>
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved