We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Same SelectionChanged event fires for different charts

Hi Syncfusion Team!

We are having a strange issue of Chart selection behavior. Here is what we are encountering:

-We have got two different charts, Doughnut and Line chart on same page, in same StackLayout.
-We have "SfDoughnutChart_OnSelectionChanged" event bound to Doughnut chart and "SfLineChart_OnSelectionChanged" event bound to Line chart.
-The problem is, "SfLineChart_OnSelectionChanged" event is called each time, whether we click on Doughnut chart or Line chart.  SfDoughnutChart_OnSelectionChanged event never fires.
-If we check e.SelectedSeries on selection event, the output is always LineSeries.
-However if we remove "SfLineChart_OnSelectionChanged" event binding from Line chart, then SfDoughnutChart_OnSelectionChanged event starts firing as expected.

Can you please respond as soon as possible. Here is our code:


<StackLayout Spacing="0" Padding="0" Orientation="Vertical">
<chart:SfChart HorizontalOptions="FillAndExpand" x:Name="DoughnutChart" VerticalOptions="FillAndExpand" SelectionChanged="SfDoughnutChart_OnSelectionChanged">
                  <chart:ChartLegend DockPosition="Bottom">
                      <chart:ChartLegendLabelStyle Font="7"/>
                <chart:DoughnutSeries DataMarkerPosition="OutsideExtended" ItemsSource="{Binding GigsData}" IsVisibleOnLegend="True"
                ConnectorLineType="Line" EnableDataPointSelection="True">
                    <chart:ChartDataMarker LabelContent="YValue">
                        <chart:DataMarkerLabelStyle Font="25" Margin="2">

<chart:SfChart HorizontalOptions="FillAndExpand" x:Name="LineChart"  VerticalOptions="FillAndExpand" SelectionChanged="SfLineChart_OnSelectionChanged">
                  <chart:ChartZoomPanBehavior EnableSelectionZooming="True" SelectionRectStrokeWidth="1" />
                  <chart:CategoryAxis PlotOffset="10"/>
                  <chart:NumericalAxis />
                  <chart:ChartLegend DockPosition="Bottom" ToggleSeriesVisibility="True">
                      <chart:ChartLegendLabelStyle Font="7"/>
                  <chart:LineSeries ItemsSource="{Binding Published}" EnableDataPointSelection="True" Label="Published" Color="{StaticResource published}">
                      <chart:ChartDataMarker ShowLabel="False" ShowMarker="True" MarkerColor="{StaticResource published}" MarkerHeight="{StaticResource MarkerHeight}" MarkerWidth="{StaticResource MarkerWidth}" />

C# Code:

   private void SfChart_OnSelectionChanged(object sender, ChartSelectionEventArgs e)
            var chart = sender as SfChart;
            //e.SelectedSeries is always Line Series in our case. 
            if (e.SelectedSeries is DoughnutSeries)

C# Code - End



2 Replies

SA Sajid Ali July 24, 2015 11:08 AM UTC

Our actual C# Code:

        private void SfDoughnutChart_OnSelectionChanged(object sender, ChartSelectionEventArgs e)
            //This event does not fires for Doughnut chart as expected.

            var chart = sender as SfChart;
            var doughnut = chart.Series[0] as DoughnutSeries;

            if (e.PreviousSelectedIndex == e.SelectedDataPointIndex)
                    doughnut.ExplodeIndex = -1;
                    doughnut.ExplodeIndex = e.SelectedDataPointIndex;

        private void SfLineChart_OnSelectionChanged(object sender, ChartSelectionEventArgs e)
               //This event fires for both Doughnut and Line Series.

YP Yuvaraj Palanisamy Syncfusion Team July 27, 2015 12:31 PM UTC

Hi Sajid,

Thanks for using Syncfusion Products.

we have created a support incident under your account to track the status of this issue.

Please log on to our support website to check for further updates.


Please let me know if you have any questions.


Live Chat Icon For mobile
Up arrow icon