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. Image for the cookie policy date
close icon

Assign specific colors to chart segments

I am trying to work out how to assign specific colors to specific values. For example
  • Insignificant = green
  • Minor = yellow
  • Moderate = orange
  • Major = light red
  • Catastrophic = dark red
  • Late = red
  • OK = green
Is there any easy way to accomplish this?

Thanks in advance.

https://imgur.com/FougTJa (embed seems to not work)

3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team February 6, 2019 01:00 PM UTC

Hi Georg, 
Greetings from Syncfusion. 
We have analyzed your query and your requirement can be achieved using two ways.  
Method 1 
If the data are declared directly in points, then you can directly use the fill property to assign the desired color. Find the code snippet below. 
<ej:Chart ID="Chart1> 
                        <ej:points Text="Insignificant" X="Insignificant" Y="10" Fill="green" /> 
                             Other configurations 
Method 2 
If you are bind data to chart using the data source, and you are having color in your data source, then using the pointColorMappingName in series. Find the code snippet below to achieve this requirement. 
       <ej:Series PointColorMappingName="fillColor"> 
Hope this helps. 

GT Georg Thomas February 12, 2019 11:18 AM UTC

Thank you! That worked a treat!

DD Dharanidharan Dharmasivam Syncfusion Team February 13, 2019 04:13 AM UTC

Hi Georg, 
Most welcome. Kindly get in touch with us, if you would require further assistance. 

Live Chat Icon For mobile
Up arrow icon