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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Assign colors to Chart DougnutSeries Items based on value

Thread ID:

Created:

Updated:

Platform:

Replies:

121372 Dec 7,2015 04:20 PM UTC Dec 8,2015 08:45 AM UTC Xamarin.Forms 3
loading
Tags: SfChart
John Rennemeyer
Asked On December 7, 2015 04:20 PM UTC

I'm using Xamarin.Forms.

I found this post which I've used to define colors for the pieces of the doughnut series: http://www.syncfusion.com/forums/120998/change-color-of-Piechart, however, I would like to know if it is possible to specify the color of a piece based on the value. For example, I have two sets of items; GOOD and BAD, and I'd like to make sure the GOOD section is Green and the BAD section is Red. In other examples, I may have 3 parts to the pie and want the third OTHER part to be LightBlue. Do you have any examples on how to do this, I'm assuming involving Binding Converters?

Thank you,

John

John Rennemeyer
Replied On December 7, 2015 04:21 PM UTC

If at all possible, I'd prefer any examples to be in XAML. Thanks!

John Rennemeyer
Replied On December 7, 2015 04:23 PM UTC

In regards to my previous comment, I wanted to clarify that as much as can be done, be done in XAML, while those things that obviously cannot be done in XAML (for example, converters) are fine.

Suresh B [Syncfusion]
Replied On December 8, 2015 08:45 AM UTC

Hi John Rennemeyer,

 

Thanks for using Syncfusion products.

 

We have prepared the sample for your requirement. In this sample, we have generated the color value for the each data point and bound it with the CustomBrushes property of the ChartColorModel. Please find the sample from the below location.

 

CodeExample:

 

<chart:DoughnutSeries.ColorModel>

         

    <chart:ChartColorModel Palette="Custom" CustomBrushes="{Binding Colors}"/>

           

 </chart:DoughnutSeries.ColorModel>

 

Sample: DoughnutSeries

 

Regards,

 

Suresh B.


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

;