Selection Behavior
The ChartSelectionBehavior allows users to "select" a point in the series. This behavior can bring much more user interactivity to RadChart and make the data in the chart much easier to understand.
Properties
-
SeriesSelectionMode: Gets or sets the ChartSelectionMode that controls the selection behavior of the chart series.
- None
- Single
- Multiple
- DataPointSelectionMode: Gets or sets the ChartSelectionMode that controls the selection behavior of the data points within the chart series.
- TouchTargetOverhang: Gets or sets the Thickness structure that will be used when calculating the touch rectangle.
- 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.
Example 1: Declaring a ChartSelectionBehavior
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartSelectionBehavior DataPointSelectionMode="Multiple"/>
</telerik:RadCartesianChart.Behaviors>
Cartesian Series Types
The Chart control implements some optimizations with regards to the drawing mechanisms in cartesian series. Part of this optimization prevents the selection behavior from operating as expected. In these cases, you can use the following approach.
- Create a custom class that inherits from
ContainerVisualsFactory
and override the CanDrawContainerVisual method.
Example 2: ContainerVisualsFactory implementation
public class MyContainerVisualFactory : ContainerVisualsFactory
{
protected override bool CanDrawContainerVisual(PresenterBase visualElement)
{
return false;
}
}
- Apply the custom class to the ContainerVisualsFactory property of the chart.
Example 3: Declaring a ChartTrackBallBehavior
<telerikChart:RadCartesianChart.ContainerVisualsFactory>
<local:MyContainerVisualFactory/>
</telerikChart:RadCartesianChart.ContainerVisualsFactory>