Hi Ahmad,
Thanks for using the Syncfusion products.
We have analysed the reported requirement. You can able to achieve this requirement with help of selection changed event in sfchart.
Code snippet [XAML]:
<chart:SfChart SelectionChanged="SfChart_SelectionChanged" >
<chart:SfChart.Behaviors>
<chart:ChartSelectionBehavior />
</chart:SfChart.Behaviors>
Code snippet [C#]:
private void SfChart_SelectionChanged(object sender, ChartSelectionChangedEventArgs e)
{
var seg = (e.SelectedSegment) as ChartSegment;
ChartSeriesBase series = seg.Series;
var b = series.GetType().GetRuntimeFields();
ObservableCollection<ChartSegment> Segments = new ObservableCollection<ChartSegment>();
foreach (var item in b)
{
if (item.Name == "Segments")
{
Segments = (ObservableCollection<ChartSegment>)item.GetValue(series);
}
}
int i = 0;
foreach (var item in Segments)
{
if (item == seg)
break;
i++;
}
(e.SelectedSeries as AccumulationSeriesBase).ExplodeIndex = i;
}
Please let us know if you require further assistance on this.
Thanks,
Karthikeyan V.
Hi Ahmad,
Thanks for the update.
We have analysed the reported query. We have suggested better solution for without using the reflector, also for this solution segment selection brush not applies. Please find the code snippet in below.
Code snippet [C#]:
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).Palette = ChartColorPalette.Metro;
else
(e.SelectedSeries as PieSeries).ExplodeIndex = b1;
}
Please let us know if you require further assistance on this.
Thanks,
Karthikeyan V.
Hi Ahmad,
Thank you for your patience,
We have analyzed the requirement and currently we don’t have
a support for default segment selection at load time, however we have achieved
this requirement in work around manner, please find the sample in the below
location,
Please let us know if you have any further assistant.
Thanks.
Suresh S.