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

But with PieSeries.ExplodeIndex


private void SfChart_SelectionChanged_1(object sender, ChartSelectionChangedEventArgs e)
{
    seg = (e.SelectedSegment) as ChartSegment;
    ChartSeriesBase series = seg.Series;
    int b1 = (series.ItemsSource as ObservableCollection<power>).IndexOf(seg.Item as power);
    if ((e.SelectedSeries as PieSeries).ExplodeIndex == b1 )
          (e.SelectedSeries as PieSeries).ExplodeIndex = -1;
    else
        (e.SelectedSeries as PieSeries).ExplodeIndex = b1;

}


But code (e.SelectedSeries as PieSeries).ExplodeIndex = -1 is not working. To de-select pie segment I have to do following:

(e.SelectedSeries as PieSeries).ExplodeIndex = 0;
(e.SelectedSeries as PieSeries).ExplodeIndex = -1;


3 Replies

SS Suresh S Syncfusion Team June 10, 2014 11:48 AM UTC

Hi Alexey,


Thanks for using Syncfusion products.


We have analyzed the reported query. Initially the segments are not updated, we have modified the content as shown in the below code snippet. Also, we have prepared the sample based on your query. Please download it from the given below location.


Code Snippet [C#]:

private void ChartBase_OnSelectionChanged(object sender, ChartSelectionChangedEventArgs e)

        {

            var seg = (e.SelectedSegment) as ChartSegment;

            ChartSeriesBase series = seg.Series;

            int b1 = (series.ItemsSource as ObservableCollection<DataValues>).IndexOf(seg.Item as DataValues);

            if ((e.SelectedSeries as PieSeries).ExplodeIndex != b1)

                (e.SelectedSeries as PieSeries).ExplodeIndex = b1;

            else

            {

                (e.SelectedSeries as PieSeries).ExplodeIndex = -1;

                (e.SelectedSeries as PieSeries).UpdateSegments(b1,NotifyCollectionChangedAction.Reset);

            }

        }

 

Please let us know if you require further assistance on this.


Regards,

Suresh S 


Attachment: Sample_7acd4ebf.zip


AS Alexey Stachikov June 10, 2014 11:55 AM UTC

Thank you. This works


SS Suresh S Syncfusion Team June 14, 2014 08:48 AM UTC

Thanks for your update.

 

We are glad that the issue resolved at your end. As always, we will be happy to assist you.

Regards,

Suresh S


Loader.
Live Chat Icon For mobile
Up arrow icon