Class StockChartLastDataLabel
Defines the options for customizing and displaying the label of the last value in the stock chart series.
Inheritance
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class StockChartLastDataLabel : OwningComponentBase
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 in stock chart.
Constructors
StockChartLastDataLabel()
Declaration
public StockChartLastDataLabel()
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 stock chart background contains multiple colors.
Examples
<SfStockChart>
<StockChartSeriesCollection>
<StockChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
<StockChartLastDataLabel ShowLabel="true" Background=”red” />
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
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
<SfStockChart>
<StockChartSeriesCollection>
<StockChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
<StockChartLastDataLabel ShowLabel="true" DashArray=”2,5” />
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
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 stock chart to the last value, improving readability and data interpretation.
Examples
<SfStockChart>
<StockChartSeriesCollection>
<StockChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
<StockChartLastDataLabel ShowLabel="true" LineColor=”Black” />
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
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 in the stock chart.
Examples
<SfStockChart>
<StockChartSeriesCollection>
<StockChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
<StockChartLastDataLabel ShowLabel="true" LineWidth=”0.5” />
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
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 System.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 StockChartLastDataLabelBorder is enabled.
Examples
// The following example demonstrates setting a horizontal radius for the data label corners:
<SfStockChart Title="AAPL Historical">
<StockChartSeriesCollection>
<StockChartSeries DataSource="@StockDetails" Type="ChartSeriesType.Candle"
XName="Date" YName="Close" High="High" Low="Low" Open="Open" Close="Close" Volume="Volume">
<StockChartLastDataLabel ShowLabel="true" Rx="10">
<StockChartLastDataLabelBorder Color="Green" Width="1"></StockChartLastDataLabelBorder>
</StockChartLastDataLabel>
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
Ry
Gets or sets the horizontal radius of the rounded corners of the last data label.
Declaration
public double Ry { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.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 StockChartLastDataLabelBorder is enabled.
Examples
// The following example demonstrates setting a horizontal radius for the data label corners:
<SfStockChart Title="AAPL Historical">
<StockChartSeriesCollection>
<StockChartSeries DataSource="@StockDetails" Type="ChartSeriesType.Candle"
XName="Date" YName="Close" High="High" Low="Low" Open="Open" Close="Close" Volume="Volume">
<StockChartLastDataLabel ShowLabel="true" Ry="10">
<StockChartLastDataLabelBorder Color="Green" Width="1"></StockChartLastDataLabelBorder>
</StockChartLastDataLabel>
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
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 stock chart series. This is particularly useful for highlighting trend endpoints or enhancing visual clarity in analytical charts.
Examples
<SfStockChart>
<StockChartSeriesCollection>
<StockChartSeries XName="X" YName="Y" DataSource="@StockData" Type="ChartSeriesType.Line">
<StockChartLastDataLabel ShowLabel="true" />
</StockChartSeries>
</StockChartSeriesCollection>
</SfStockChart>
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |