Class ChartLastDataLabel
Defines the options for customizing and displaying the label of the last value in the series.
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 |
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 |
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 |
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 |
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 |
|
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>