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

On Pie Chart Click Event

I have used synfusion library in xamarin forms to create a doughnut chart. Now, I want to open another page on clicking any of the slices in a doughnut. The attribute explode_all_on_touch just explodes the slices. But , I want to open a different page on clicking any of the slices. How can I achieve this?? Please help me out.

1 Reply

PS Parthiban Sundaram Syncfusion Team August 28, 2017 10:20 AM UTC

Hi Aman,

Thanks for using Syncfusion Products.

We have achieved your requirement using SelectionChanging event in SfChart to navigate the different page. Please find the below code snippet for more details.

Code Snippet:
 
   
XAML Code:  
   
  <chart:SfChart SelectionChanging="Chart_SelectionChanging">  
...  
<chart:DoughnutSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue" EnableDataPointSelection="true">  
  </chart:DoughnutSeries>  
...  
</chart:SfChart>  
   
C#:  
   
        privatevoid Chart_SelectionChanging(object sender, ChartSelectionChangingEventArgs e)  
        {  
             e.Cancel = true// Disables the datapoint selection  
            Navigation.PushModalAsync(newNewPage());  
        }  
   
 


Sample: http://www.syncfusion.com/downloads/support/forum/132309/ze/DoughnutSample-102519379  

Please refer the below UG link for enabling or disabling the data point selection.

https://help.syncfusion.com/xamarin/sfchart/selection  

Please let us know, if you need further assistance on this.

Regards,
Parthiban S
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon