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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Same SelectionChanged event fires for different charts

Thread ID:





119720 Jul 24,2015 11:00 AM UTC Jul 27,2015 12:31 PM UTC Xamarin.Forms 2
Tags: SfChart
Sajid Ali
Asked On July 24, 2015 11:00 AM UTC

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



Sajid Ali
Replied On 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.

Yuvaraj Palanisamy [Syncfusion]
Replied On 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.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon