I'm wondering is there a way to change the default pie-chart colors? the default random colors does not work in my scenario and we have our own set of colors like to implement in the pie-chart.

Here is my current code looks like:

<apex:pageBlockSectionItem >
   <apex:chart height="300" width="500" data="{!PieChartData}">
     <apex:pieSeries labelField="Colorpicker__c" dataField="data">
        <apex:chartLabel display="rotate" field="Colorpicker__c"/>
        <apex:legend position="right"/>

You can use colorset attribute documented here to provide custom colors

<apex:pageBlockSection title="Simple colorSet Demo">
<apex:chart data="{!pieData}" height="300" width="400" background="#F5F5F5">
    <apex:legend position="left"/>
    <apex:pieSeries labelField="name" dataField="data1"

A colorSet is a string that is a comma-delimited list of HTML-style hexadecimal color definitions. For example, colorSet="#0A224E,#BF381A,#A0D8F1,#E9AF32,#E07628". Colors are used in sequence. When the end of the list is reached, the sequence starts over at the beginning

  • Is there a way to control colorset? Meaning that if the chart renders ABC then render red color
    – Nick Kahn
    Sep 19 '16 at 3:47
  • yes .The order in which you specify actually maps to your column in your dataset Sep 19 '16 at 3:51
  • Thanks hmmm but in my situation the order will be dynamic so not sure which comes first but can you do mapping or some sort?, sorry I should have put that in my question.
    – Nick Kahn
    Sep 19 '16 at 4:01
  • The thing is order of list is always fixed .So you can trust the rendering engine of column .To be sure sort your list by name Sep 19 '16 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.