Class SfStockChart
Stock Chart is a well-crafted, easy-to-use financial charting package to track and visualize the stock price of any company over a specific period using charting (such as Candlestick chart, OHLC, etc) and range tools.
Inherited Members
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfStockChart : SfDataBoundComponent
Constructors
SfStockChart()
Declaration
public SfStockChart()
Properties
Background
The background color of the stock chart that accepts value in hex and rgba as a valid CSS color string.
Declaration
public string Background { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | Accepts the string value that specifies the background color of stock chart. |
DataSource
Specifies the data source for the stock chart. It can be an array of JSON objects or an instance of DataManager.
Declaration
public IEnumerable<object> DataSource { get; set; }
Property Value
| Type |
|---|
| System.Collections.Generic.IEnumerable<System.Object> |
EnableCustomRange
Defines the custom range.
Declaration
public bool EnableCustomRange { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
EnablePeriodSelector
It specifies whether the period selector to be rendered in financial chart.
Declaration
public bool EnablePeriodSelector { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
EnableRtl
Enable or disable rendering component in right to left direction.
Declaration
public bool EnableRtl { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
EnableSelector
It specifies whether the range navigator to be rendered in financial chart.
Declaration
public bool EnableSelector { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
ExportType
It specifies the types of export options in financial chart.
Declaration
public List<ExportType> ExportType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ExportType> | A list of ExportType enumeration values that specifies the types of export options available in stock chart. The available exported values are "PNG, JPEG, SVG, PDF". |
Height
The height of the stock chart as a string accepts input both as '100px' or '100%'. If specified as '100%, stockChart renders to the full height of its parent element.
Declaration
public string Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | Accepts the string value in the format "100px" or "100%". |
ID
Gets and sets the identification of the component.
Declaration
public string ID { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | Accepts the string value. |
IndicatorType
It specifies the types of indicators in financial chart.
Declaration
public List<TechnicalIndicators> IndicatorType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<TechnicalIndicators> | A list of TechnicalIndicators enumeration values that specifies the types of technical indicators available in stock chart. The available indicator values are "Ema, Tma, Sma, Momentum, Atr, AccumulationDistribution, BollingerBands, Macd, Stochastic, Rsi". |
IsMultiSelect
If set true, enables the multi-selection in chart. It requires SelectionMode set to be Point | Series | or Cluster.
Declaration
public bool IsMultiSelect { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsSelect
If set true, enables the animation in chart.
Declaration
public bool IsSelect { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsTransposed
It specifies whether the stock chart should be render in transposed manner or not.
Declaration
public bool IsTransposed { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
NoDataTemplate
Specifies the template to be displayed when the stock chart has no data.
Declaration
public RenderFragment NoDataTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.AspNetCore.Components.RenderFragment | Accepts a Microsoft.AspNetCore.Components.RenderFragment that allows rendering custom content when the chart has no data. |
Remarks
This template allows users to display customized messages, images, or other UI elements in place of an empty stock chart. It provides a better user experience by offering context when no data points are available.
Examples
<SfStockChart>
<NoDataTemplate>
<div>No data available to display.</div>
</NoDataTemplate>
</SfStockChart>
SelectionMode
Specifies whether series or data point has to be selected. They are, None: Disables the selection. Series: Selects a series. Point: Selects a point. Cluster: Selects a cluster of point. DragXY: Selects points by dragging with respect to both horizontal and vertical axes. DragX: Selects points by dragging with respect to horizontal axis. DragY: Selects points by dragging with respect to vertical axis.
Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
| Type | Description |
|---|---|
| SelectionMode | One of the SelectionMode enumeration that specifies the selection mode of chart. The default value is None. |
SeriesType
It specifies the types of series in financial chart.
Declaration
public List<ChartSeriesType> SeriesType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ChartSeriesType> | A list of ChartSeriesType enumeration values that specifies the types of chart series available in the stock chart. The available series types are "Line, Hilo, HiloOpenClose, Candle, Spline". |
Theme
Specifies the theme for the stock chart.
Declaration
public Theme Theme { get; set; }
Property Value
| Type | Description |
|---|---|
| Theme | Accepts a value from the Theme enum. The default value is Bootstrap4. |
Title
Title of the stock chart.
Declaration
public string Title { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | Accepts the string value. The default value is empty. |
TrendlineType
It specifies the types of trendline types in financial chart.
Declaration
public List<TrendlineTypes> TrendlineType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<TrendlineTypes> | A list of TrendlineTypes enumeration values that specifies the types of trendlines available in the stock chart. The available trendline types are "Linear, Exponential, Polynomial, Logarithmic, MovingAverage". |
Width
The width of the stock chart as a string accepts input as both like '100px' or '100%'. If specified as '100%, stock chart renders to the full width of its parent element.
Declaration
public string Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | Accepts the string value in the format "100px" or "100%". |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
ExportAsync(ExportType, String, Nullable<PdfPageOrientation>, Boolean, Boolean)
The method is used to perform the export functionality for the rendered stock chart.
Declaration
public Task ExportAsync(ExportType type, string fileName, Nullable<PdfPageOrientation> orientation = null, bool allowDownload = true, bool isBase64 = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ExportType | type | Specifies the export type for the rendered stock chart. |
| System.String | fileName | Specifies the filename. |
| System.Nullable<Syncfusion.PdfExport.PdfPageOrientation> | orientation | Specifies the portrait or landscape orientation of the page. |
| System.Boolean | allowDownload | Specifies whether to download or not. |
| System.Boolean | isBase64 | Specify whether to obtain the chart image as a base64 string or not. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
GetStockChartTooltipPosition()
Returns the stock chart tooltip position.
Declaration
public string GetStockChartTooltipPosition()
Returns
| Type | Description |
|---|---|
| System.String | The tooltip position as a string. |
Remarks
For internal use only.
PrintAsync(ElementReference)
The method is used to perform the print functionality in stock chart.
Declaration
public Task PrintAsync(ElementReference elementRef = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Components.ElementReference | elementRef |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Refresh()
Method helps to re-render the stock chart.
Declaration
public void Refresh()
UpdateStockChart()
Method helps to re-render the stock chart UI element.
Declaration
public void UpdateStockChart()