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 | Default | Type |
|---|---|---|
ChildContent | null | RenderFragment |
Specifies the content to render inside this Chart. | ||
Data | null | ChartData<TItem> |
Specifies the chart data. | ||
DataJsonString | — | string |
Specifies the chart data that is serialized as json string. | ||
Options | null | TOptions |
Specifies the chart options. | ||
OptionsJsonString | — | string |
Specifies the chart options that is serialized as json string. | ||
OptionsObject | null | object |
Specifies the chart options that is serialized as json object. | ||
Type | ChartType.Line | ChartType |
Specifies the chart type. Possible values: LineBarPieDoughnutPolarAreaRadarScatterBubble | ||
Events
Chart
| Event | Type |
|---|---|
Clicked | EventCallback<ChartMouseEventArgs> |
Raised when clicked on data point. | |
Hovered | EventCallback<ChartMouseEventArgs> |
Raised when hovered over data point. | |
MouseOut | EventCallback<ChartMouseEventArgs> |
Raised when mouse leaves the chart area. | |
Methods
Chart
| Method | Return | Parameters |
|---|---|---|
AddDataSet | Task | TDataSet[] datasets |
Adds a new dataset to the chart.
| ||
AddDatasetsAndUpdate | Task | TDataSet[] datasets |
Adds new datasets and then update the chart.
| ||
AddData | Task | int dataSetIndex, TItem[] data |
Adds the new data point(s) to the specified dataset.
| ||
AddLabelsDatasetsAndUpdate | Task | IReadOnlyCollection<object> labels, TDataSet[] datasets |
Adds new set of labels and datasets and then update the chart.
| ||
AddLabels | Task | object[] labels |
Adds a new label to the chart.
| ||
ChangeType | Task | ChartType type |
Destroy the current chart instance and recreates it by using the same data and options.
| ||
Clear | Task | — |
Clears all the labels and data from the chart.
| ||
Destroy | Task | — |
Destroys the chart instance. Calling this method should generally dispose of any chart resources.
| ||
PopData | Task | int dataSetIndex |
Removes the newest data point from the specified dataset.
| ||
PopLabel | Task | — |
Removes the newest label.
| ||
RemoveDataSet | Task | int dataSetIndex |
Removed the dataset at the specified index.
| ||
Resize | Task | — |
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.
| ||
SetData | Task | int dataSetIndex, List<TItem> data |
Sets the new data point(s) to the specified dataset.
| ||
SetOptionsObject | Task | object optionsObject |
Sets the chart's OptionsObject manually. Must call Update after manging this call. If the options changes AspectRatio must also call Resize after Update.
| ||
SetOptions | Task | TOptions options |
Sets the chart's options manually. Must call Update after making this call. If the options changes AspectRatio must also call Resize after Update.
| ||
ShiftData | Task | int dataSetIndex |
Removes the oldest data point from the specified dataset.
| ||
ShiftLabel | Task | — |
Removes the oldest label.
| ||
Update | Task | — |
Update and redraw the chart.
| ||
NotifyPluginInitialized | void | ChartPlugin plugin |
Notifies the chart that it contains the plugin.
| ||
NotifyPluginRemoved | void | ChartPlugin plugin |
Notifies the chart that it should remove the plugin. Freeing the reference.
| ||
ChartTrendline
| Method | Return | Parameters |
|---|---|---|
AddTrendLineOptions | Task | List<ChartTrendlineData> trendlineData |
Adds the trendline options to the chart.
| ||