Hi Tirumaleswara,
Thanks for contacting Syncfusion Support.
You can achieve this requirement(displaying category with same color) by specifying desired color to the segment in ViewModel and access it through the property “SegmentColorPath” of chart series as like in the below code snippet,
Code Snippet[XAML]
|
<chart:PieSeries ItemsSource="{Binding Data}" SegmentColorPath="SegmentColor"
LegendIcon="Triangle" XBindingPath="XValue" YBindingPath="YValue"> |
Code Snippet[ViewModel.cs]
|
public class ViewModel
{
public ObservableCollection<Model> Data { get; set; }
public ViewModel()
{
Data = new ObservableCollection<Model>();
Data.Add(new Model() { XValue = "Part1", YValue = 3, SegmentColor = new SolidColorBrush(Colors.LawnGreen) });
Data.Add(new Model() { XValue = "UnallocatedSpace", YValue = 4, SegmentColor = new SolidColorBrush(Colors.DeepPink) });
Data.Add(new Model() { XValue = "Partition5", YValue = 2, SegmentColor = new SolidColorBrush(Colors.Cyan) });
Data.Add(new Model() { XValue = "UnallocatedSpace", YValue = 6.9, SegmentColor = new SolidColorBrush(Colors.DeepPink) });
}
} |
Please find the output screenshot below,
The reference sample can be downloaded from below location,
Also, you can refer our UG documentation link to know more about this property,
Regards,
Durgadevi S