How to control interior color of a PieChart
<chart:SfChart x:Name="AppsChart" AreaBorderThickness="0" ><chart:SfChart.Legend> <chart:ChartLegend DockPosition="Right" CheckBoxVisibility="Visible"/> </chart:SfChart.Legend><chart:SfChart.PrimaryAxis> <chart:CategoryAxis/> </chart:SfChart.PrimaryAxis> <chart:SfChart.SecondaryAxis> <chart:NumericalAxis/> </chart:SfChart.SecondaryAxis> <chart:PieSeries ConnectorType="Line" EnableSmartLabels="true" LabelPosition="OutsideExtended" EnableAnimation="True" x:Name="pieSeries" ShowTooltip="True" chart:ChartTooltip.EnableAnimation="True" ItemsSource="{Binding ViewModel.PieList}" XBindingPath="Name" YBindingPath="Count" Margin="0"> </chart:PieSeries> </chart:SfChart>
Hi Rodolphe,
We have analyzed your requirement and you can manually set Pie segments color by using the property palette as custom for the PieSeries as shown in the below code snippet.
Code Snippet [XAML]:
<chart:PieSeries
Palette="Custom"
XBindingPath="Country" YBindingPath="Count" ItemsSource="{Binding
Data}">
<chart:PieSeries.ColorModel>
<chart:ChartColorModel>
<chart:ChartColorModel.CustomBrushes>
<SolidColorBrush
Color="BlanchedAlmond"></SolidColorBrush>
<SolidColorBrush
Color="CadetBlue"></SolidColorBrush>
<SolidColorBrush
Color="Crimson"></SolidColorBrush>
<SolidColorBrush
Color="Red"></SolidColorBrush>
<SolidColorBrush
Color="DarkGray"></SolidColorBrush>
</chart:ChartColorModel.CustomBrushes>
</chart:ChartColorModel>
</chart:PieSeries.ColorModel>
</chart:PieSeries>
We have prepared a sample based on this and please find the attached sample.
Please let us know if you have any queries.
Thanks,
Mohammed Azarudeen.
Attachment: PiSeries_Color_6a5e7181.zip
Hi Rodolphe,
We have analyzed your requirement and you can able to bind
view model property(with the brushes added to it) to the ColorModel property of
the PieSeries as shown in the below code snippet.
Code Snippet [XAML]:
<chart:PieSeries ConnectorType="Line" ColorModel="{Binding
CustomBrushes, Converter={StaticResource converter}}"
Palette="Custom" XBindingPath="Country"
YBindingPath="Count" ItemsSource="{Binding Data}"
EnableSmartLabels="true"
LabelPosition="OutsideExtended"
EnableAnimation="True" ShowTooltip="True”
chart:ChartTooltip.EnableAnimation="True">
We have prepared a sample based on this and please find the
attached sample.
Please let us know if you have any queries.
Thanks,
Mohammed Azarudeen.
Attachment: ColorModelBinding_fad4e097.zip
Currently we are not having the support to achieve your requirement. We have consider this as a feature request and it can be tracked through our Features Management System.
FR Link: http://www.syncfusion.com/support/directtrac/features/WRT-3707
Please let us know if you have any queries.
Thanks,
Magesh Kumar K
- 5 Replies
- 3 Participants
-
RB Rodolphe Billottet
- Oct 17, 2014 11:28 AM UTC
- Nov 15, 2014 05:03 AM UTC