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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically set the value for PieSeries.ColorModel

Thread ID:

Created:

Updated:

Platform:

Replies:

119604 Jul 14,2015 08:22 AM UTC Jul 15,2015 04:06 AM UTC WPF 2
loading
Tags: SfChart
Krishna Kumar Nanjundaprasad
Asked On July 14, 2015 08:22 AM UTC

Hi,

Hope you are doing well.

Can you please let me know if there is a possibility to set the ColorModel for a SfChart.PieSeries programmatically?
I achieved till setting the value for ChartColorModel which is as follows;

ChartColorModel colorModel = new ChartColorModel();
colorModel.CustomBrushes.Add((SolidColorBrush)(new BrushConverter().ConvertFrom("#49B792")));
colorModel.CustomBrushes.Add((SolidColorBrush)(new BrushConverter().ConvertFrom("#FCBF00")));
colorModel.CustomBrushes.Add((SolidColorBrush)(new BrushConverter().ConvertFrom("#B3181F")));

Now I facing a problem to add this ChartColorModel to PieSeries.ColorModel or I can say I don't know how to add this ChartColorModel to the PieSeries.ColorModel in C#.
Please help me with this.

Thank you very much in advance.

Best Regards,
Krishna Kumar

Krishna Kumar Nanjundaprasad
Replied On July 14, 2015 10:40 AM UTC

Hi,

Fortunately, I bound the created object to the ColorModel property of the pie series and it worked.
Thanks again.

Code for reference;
<sfchart:PieSeries DockPanel.Dock="Left" LabelPosition="Inside" sfchart:ChartTooltip.EnableAnimation="True"
                                   ItemsSource="{Binding ChartData}" XBindingPath="{Binding XBindingPathValue}" YBindingPath="{Binding YBindingPathValue}" PieCoefficient="0.50" 
                                   EnableSmartLabels="True" SelectedIndex="{Binding SelectedChartSegmentIndex,Mode=TwoWay}"
                                   ShowTooltip="True" HorizontalContentAlignment="Left" Width="auto"
                                   Margin="-50,-50,-50,-50" FontSize="20" FontWeight="Bold"
                                   Palette="Custom" ColorModel="{Binding colorModel}">
</sfchart:PieSeries>

Best regards,
Krishna Kumar

Rachel A [Syncfusion]
Replied On July 15, 2015 04:06 AM UTC

Hi Krishna,

Thanks for the update.

Please let us know if you need any further assistance.

Thanks,
Rachel. A

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;