menu

Blazor

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

    Show / Hide Table of Contents

    Class ChartLastDataLabel

    Defines the options for customizing and displaying the label of the last value in the series.

    Inheritance
    System.Object
    ChartSubComponent
    ChartLastDataLabel
    Namespace: Syncfusion.Blazor.Charts
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ChartLastDataLabel : ChartSubComponent, ISubcomponentTracker, IChartElement
    Remarks

    This property allows you to display a label for the last value in a series, with customizable appearance options such as background color, line color, and dash pattern.

    Constructors

    ChartLastDataLabel()

    Declaration
    public ChartLastDataLabel()

    Properties

    Background

    Gets or sets the background color of the last value label.

    Declaration
    public string Background { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the background color (e.g., "#ffffff" or "transparent").
    The default value is "transparent".

    Remarks

    Useful for enhancing label visibility, especially when the chart background contains multiple colors.

    Examples
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" Background="red" />
        </ChartSeries>
       </ChartSeriesCollection>
    </SfChart>

    DashArray

    Gets or sets the dash pattern for the grid line behind the last value label.

    Declaration
    public string DashArray { get; set; }
    Property Value
    Type Description
    System.String

    A string defining the dash array (e.g., "4,2" for dashed lines).
    The default value is an empty string, which results in a solid line.

    Remarks

    This property is useful for distinguishing the indicator line from other grid lines or series lines.

    Examples
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" DashArray="2,5" />
        </ChartSeries>
       </ChartSeriesCollection>
    </SfChart>

    LineColor

    Gets or sets the color of the grid line displayed behind the last value label.

    Declaration
    public string LineColor { get; set; }
    Property Value
    Type Description
    System.String

    A string specifying the grid line color.
    The default value is an empty string, which means the series color will be used.

    Remarks

    This property helps provide a direct reference line across the chart to the last value, improving readability and data interpretation.

    Examples
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" LineColor="black" />
       </ChartSeriesCollection>
        </ChartSeries>
    </SfChart>

    LineWidth

    Gets or sets the width of the line displayed behind the last value label.

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

    A double value specifying the thickness of the grid line.
    The default value is 1.

    Remarks

    Thicker lines can improve visibility, especially when multiple series are present.

    Examples
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" LineWidth="0.5" />
        </ChartSeries>
       </ChartSeriesCollection>
    </SfChart>

    Rx

    Gets or sets the horizontal radius of the rounded corners of the last data label.

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

    A double value representing the horizontal width of the rounded corner. The default value is 5.

    Remarks

    This property affects the appearance of the corners of the last data label's background. This property is applicable only when ChartLastDataLabelBorder is enabled.

    Examples
    // The following example demonstrates setting a horizontal radius for the data label corners:
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" Rx="10">
                <ChartLastDataLabelBorder Color="Green" Width="1"></ChartLastDataLabelBorder>
            </ChartLastDataLabel>
       </ChartSeriesCollection>
        </ChartSeries>
    </SfChart>

    Ry

    Gets or sets the vertical radius of the rounded corners of the last data label.

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

    A double value representing the vertical width of the rounded corner. The default value is 5.

    Remarks

    This property affects the appearance of the corners of the last data label's background. This property is applicable only when ChartLastDataLabelBorder is enabled.

    Examples
    // The following example demonstrates setting a horizontal radius for the data label corners:
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" Ry="10">
                <ChartLastDataLabelBorder Color="Green" Width="1"></ChartLastDataLabelBorder>
            </ChartLastDataLabel>
       </ChartSeriesCollection>
        </ChartSeries>
    </SfChart>

    ShowLabel

    Gets or sets a value indicating whether the label and indicator for the last data point in the series are visible.

    Declaration
    public bool ShowLabel { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to display the last value label and the corresponding grid line indicator; otherwise, false.
    The default value is false.

    Remarks

    Use this property to toggle the visibility of the last data label in the chart series.
    This is particularly useful for highlighting trend endpoints or enhancing visual clarity in analytical charts.

    Examples
    <SfChart>
       <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
            <ChartLastDataLabel ShowLabel="true" />
        </ChartSeries>
       </ChartSeriesCollection>
    </SfChart>
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved