Blazorise Chart API
Explore the Blazorise Chart API reference for charts and related plugins.
For examples and usage guidance, see the Chart documentation.
API
Parameters
Chart
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this Chart. |
RenderFragment | null |
Data |
Specifies the chart data. |
ChartData<TItem> | null |
DataJsonString |
Specifies the chart data that is serialized as json string. |
string | |
Options |
Specifies the chart options. |
TOptions | null |
OptionsJsonString |
Specifies the chart options that is serialized as json string. |
string | |
OptionsObject |
Specifies the chart options that is serialized as json object. |
object | null |
Type |
Specifies the chart type. Possible values: |
ChartType | ChartType.Line |
Events
Chart
| Event | Description | Type |
|---|---|---|
Clicked |
Raised when clicked on data point. |
EventCallback<ChartMouseEventArgs> |
Hovered |
Raised when hovered over data point. |
EventCallback<ChartMouseEventArgs> |
MouseOut |
Raised when mouse leaves the chart area. |
EventCallback<ChartMouseEventArgs> |
Methods
Chart
| Method | Description | Return | Parameters |
|---|---|---|---|
AddDataSet |
Adds a new dataset to the chart. | Task | TDataSet[] datasets |
AddDatasetsAndUpdate |
Adds new datasets and then update the chart. | Task | TDataSet[] datasets |
AddData |
Adds the new data point(s) to the specified dataset. | Task | int dataSetIndex, TItem[] data |
AddLabelsDatasetsAndUpdate |
Adds new set of labels and datasets and then update the chart. | Task | IReadOnlyCollection<object> labels, TDataSet[] datasets |
AddLabels |
Adds a new label to the chart. | Task | object[] labels |
ChangeType |
Destroy the current chart instance and recreates it by using the same data and options. | Task | ChartType type |
Clear |
Clears all the labels and data from the chart. | Task | |
Destroy |
Destroys the chart instance. Calling this method should generally dispose of any chart resources. | Task | |
PopData |
Removes the newest data point from the specified dataset. | Task | int dataSetIndex |
PopLabel |
Removes the newest label. | Task | |
RemoveDataSet |
Removed the dataset at the specified index. | Task | int dataSetIndex |
Resize |
Manually resize the canvas element. This is run each time the canvas container is resized, but you can call this method manually if you change the size of the canvas nodes container element. Should also be called when updating the aspect ratio. | Task | |
SetData |
Sets the new data point(s) to the specified dataset. | Task | int dataSetIndex, List<TItem> data |
SetOptionsObject |
Sets the chart's OptionsObject manually. Must call Update after manging this call. If the options changes AspectRatio must also call Resize after Update. | Task | object optionsObject |
SetOptions |
Sets the chart's options manually. Must call Update after making this call. If the options changes AspectRatio must also call Resize after Update. | Task | TOptions options |
ShiftData |
Removes the oldest data point from the specified dataset. | Task | int dataSetIndex |
ShiftLabel |
Removes the oldest label. | Task | |
Update |
Update and redraw the chart. | Task | |
NotifyPluginInitialized |
Notifies the chart that it contains the plugin. | void | ChartPlugin plugin |
NotifyPluginRemoved |
Notifies the chart that it should remove the plugin. Freeing the reference. | void | ChartPlugin plugin |
ChartTrendline
| Method | Description | Return | Parameters |
|---|---|---|---|
AddTrendLineOptions |
Adds the trendline options to the chart. | Task | List<ChartTrendlineData> trendlineData |