Version

Selection

This topic provides information for enabling and using the selection feature in the UltraDataPieChart control.

The topic contains the following sections:

Requirements

This article assumes you have already read the Data Binding topic, and uses the code within it as a starting point.

Selection Overview

The UltraDataPieChart supports slice selection by mouse click on the slices plotted in the chart. The different facets of the selection feature in the chart are described below:

Selection Behaviors

The main two options of the SelectionBehavior are PerDataItemSingleSelect and PerDataItemMultiSelect, which will enable single and multiple selection, respectively.

Selection Modes

The SelectionMode property determines how the pie chart slices respond to being selected. This property is defined by the SeriesSelectionMode enumeration. The following are the options of that enumeration and what they do:

  • Brighten: The selected slices will be highlighted.

  • FadeOthers: The selected slices will remain their same color and others will fade.

  • FocusColorFill: The selected slices will change their background to the FocusBrush of the UltraDataPieChart control.

  • FocusColorOutline: The selected slices will have an outline with the color defined by the FocusBrush of the UltraDataPieChart control.

  • FocusColorThickOutline: The selected slices will have an outline with the color defined by the FocusBrush of the UltraDataPieChart control. The thickness of this outline can be configured via the Thickness property of the control as well.

  • GrayscaleOthers: The unselected slices will have a gray color filter applied to them.

  • None: There is no effect on the selected slices.

  • SelectionColorFill: The selected slices will change their background to the SelectionBrush of the UltraDataPieChart control.

  • SelectionColorOutline: The selected slices will have an outline with the color defined by the SelectionBrush of the UltraDataPieChart control.

  • SelectionColorThickOutline: The selected slices will have an outline with the color defined by the FocusBrush of the UltraDataPieChart control. The thickness of this outline can be configured via the Thickness property of the control as well.

  • ThickOutline: The selected slices will apply an outline with the thickness dependent on the Thickness property of the UltraDataPieChart control.

Selection Events

When a slice is selected, it’s underlying data item will be added to the SelectedSeriesItems collection of the chart. As such, the UltraDataPieChart exposes the SelectedSeriesItemsChanged event to detect when a slice has been selected and this collection is changed.

Code Example

In C#:

UltraDataPieChart dataPieChart = new UltraDataPieChart()
{
    DataSource = data,
    Dock = DockStyle.Fill,
    SelectionBehavior = SeriesSelectionBehavior.PerDataItemMultiSelect,
    SelectionMode = SeriesSelectionMode.SelectionColorFill,
    SelectionBrush = Brushes.DodgerBlue
};

Related Content