+ Start a Discussion
Marcio Zima.ax1538Marcio Zima.ax1538 

Color order of Visualforce chart

I'm using a field formula text that returns HIGH, MEDIUM or LOW. 


Now I'm having problems to show the colors (HIGH=red, MEDIUM=yellow, LOW=green) on a Visualforce chart.


The code is:


<apex:pieSeries dataField="value" labelField="label" colorset="#ff0000, #00dd00, #ffff00" />



It's working when there are data to high, medium and low status. When there are just medium and low, on chart appears red and yellow. When there is just low status, for example, appears just red color.


How can I fix a color to each status and not to show in order like in this parameters of Visualforce chart?


According to the developer's guide, colorsets are used in sequence, so if you only have LOW status, it will pick the first entry in the series.  This sounds like you need to dynamically generate the colorset value based on the contents of your dataset.  Once you have retrieved your data, you'll need to traverse it and figure out which colors need to be present.

Ronaldo CostaRonaldo Costa

Do you know how can I do this? Is there some structure?


Standard visualforce I would have thought - set up a controller property with the list of colours that should be used.