ChartSelectionBehavior
Overview
ChartSelectionBehavior is responsible for selecting, deselecting and reporting the selection of either data points or series. In other words, the selection behavior can target data points, series or both if required.
With R2 2018 SP release Behaviors property of RadChart was replaced with ChartBehaviors. Behaviors property is marked as obsolete, so please use ChartBehaviors instead.
Features
Properties
-
DataPointSelectionMode: Gets or sets the ChartSelectionMode that controls the selection behavior of the data points within the chart series. The available values are:
- None
- Single
- Multiple
-
SeriesSelectionMode: Gets or sets the ChartSelectionMode that controls the selection behavior of the series within the plot area. The available values are:
- None
- Single
- Multiple
- SelectedPoints: Retrieves all the points from all series within the chart plot area that are currently selected.
- SelectedSeries: Retrieves all the series instances within the plot area that are currently selected.
Methods
- ClearSelecton() method : Removes the current selection within the chart.
Events
- SelectionChanged event: Occurs when a selection has been made.
Commands
ChartSelectionBehavior exposes support for Commands.
Example
Here is an example of how the Chart Selection Behavior works with Command:
First, create the needed business objects, for example:
Then create a ViewModel:
Finally, use the following snippet to declare a RadCartesianChart in XAML and in C#:
Where the telerikChart namespace is the following:
Here is how the selection looks:
A sample Selection example can be found in the Chart/Interactivity folder of the SDK Samples Browser application.