ComponentOne Xamarin Edition
Controls > FlexChart > Features > Selection

You can choose what element of the FlexChart should be selected when the user taps on any region in a FlexChart by setting the SelectionMode property. This property accepts one of the following values from ChartSelectionModeType enum:

The images below show how the FlexChart appears after these properties have been set.

When SelectionMode is set to Series

When SelectionMode is set to Point

The following code examples demonstrate how to set these properties in C# and XAML. This example uses the sample created in the Quick Start section.

In Code

Copy Code
//Create series
ChartSeries series = new ChartSeries();
series.SeriesName = "Sales";
series.Binding = "Sales";
series.ChartType = ChartType.Column;

ChartSeries series1 = new ChartSeries();
series1.SeriesName = "Expenses";
series1.Binding = "Expenses";
series1.ChartType = ChartType.Column;            

//Set selection mode
chart.SelectionMode = ChartSelectionModeType.Point;


Copy Code
<c1:FlexChart x:Name="chart" ItemsSource="{Binding Data}" BindingX="Name" ChartType="Column"
    Grid.Row="1" Grid.ColumnSpan="2" VerticalOptions="FillAndExpand" SelectionMode="Point">
        <c1:ChartSeries x:Name="Sales2015" SeriesName ="Sales" Binding="Sales" />
        <c1:ChartSeries x:Name="Expenses2015" SeriesName="Expenses" Binding="Expenses"/>