Stock Chart Events
This article explains the available events for the Telerik Stock Chart for Blazor:
OnDragEnd
The Stock Chart OnDragEnd event fires at the end of a drag (pan) gesture. The event argument is of type ChartDragEndEventArgs and exposes the following properties:
| Property | Type | Description |
|---|---|---|
AxisRanges | Dictionary<string, ChartAxisRange> | The visible range of each axis at the end of the drag. The dictionary key is the axis name. Each ChartAxisRange value has Min and Max properties that reflect the new axis range. |
The OnDragEnd event fires after OnDragStart.
OnDragStart
The Stock Chart OnDragStart event fires at the beginning of a drag (pan) gesture. The event argument is of type ChartDragStartEventArgs and exposes the following properties:
| Property | Type | Description |
|---|---|---|
AxisRanges | Dictionary<string, ChartAxisRange> | The visible range of each axis at the start of the drag. The dictionary key is the axis name. Each ChartAxisRange value has Min and Max properties that reflect the current axis range. |
The OnDragStart event fires before OnDragEnd.
OnSeriesClick
The OnSeriesClick event fires as a response to the user click on a <StockChartSeries>.
Below you can find:
Event Arguments
The event handler receives a ChartSeriesClickEventArgs object which provides the following data:
-
DataItem- provides the data model of the current series item. You need to cast it to the type from your data source, which needs to be serializable.- For
OHLCandCandlestickchart types theDataItemwill contain the information mapped to theOpenField,CloseField,HighFieldandLowFieldproperties. - For
Line,AreaandColumntheDataItemwill contain the information mapped to theFieldproperties. - The
DataItemwill contain an aggregated value for the date, so in order to get it you can use theCategoryand parse it toDateTime.
- For
-
Category- provides information on the category the data point is located in. Since the Stock Chart has a date X axis theCategoryshould be cast toDateTime. -
SeriesIndex- provides the index of the<StockChartSeries>the data point belongs to. -
Percentage- for the Stock Chart the value will always be0. -
SeriesName- bound to the Name parameter of the<StockChartSeries>the data point belongs to. -
SeriesColor- shows the RGB color of the Series the data point belongs to. -
CategoryIndex- shows the index of the data point's x-axis category.
Examples
These examples showcase the different applications of the OnSeriesClick event.
Basic Click Handler
Get The Data Model For The Clicked Series
OnZoomEnd
The Stock Chart OnZoomEnd event fires at the end of a zoom gesture. The event argument is of type ChartZoomEndEventArgs and exposes the following properties:
| Property | Type | Description |
|---|---|---|
AxisRanges | Dictionary<string, ChartAxisRange> | The visible range of each axis at the end of the zoom. The dictionary key is the axis name. Each ChartAxisRange value has Min and Max properties that reflect the new axis range. |
The OnZoomEnd event fires after OnZoomStart.
OnZoomStart
The Stock Chart OnZoomStart event fires at the beginning of a zoom gesture. The event argument is of type ChartZoomStartEventArgs and exposes the following properties:
| Property | Type | Description |
|---|---|---|
AxisRanges | Dictionary<string, ChartAxisRange> | The visible range of each axis at the start of the zoom. The dictionary key is the axis name. Each ChartAxisRange value has Min and Max properties that reflect the current axis range. |
The OnZoomStart event fires before OnZoomEnd.