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

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> 
          <Series> 
                <ej:Series> 
                    <Points> 
                        <ej:points Text="Insignificant" X="Insignificant" Y="10" Fill="green" /> 
                             Other configurations 
                    </Points> 
                 </ej:Series> 
            </Series> 
        </ej:Chart> 
 
 
Screenshot: 
 
 
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. 
 
 
<Series> 
       <ej:Series PointColorMappingName="fillColor"> 
        </ej:Series> 
 </Series> 
 
 
Hope this helps. 
 
Thanks, 
Dharani. 



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. 
 
Thanks, 
Dharani. 


Loader.
Live Chat Icon For mobile
Up arrow icon