I am implementing Struts 2 JQuery pie charts. I don't know how set custom colors for the chart. In backend I just create map with key
as String
and value
as integer. What attribute I should use for setting custom color or how to set custom color in the pie chart.
My code is:
<sjc:chart
id="chartPie2"
cssStyle="width: 600px; height: 400px;"
legendShow="false"
pie="true"
pieLabel="true"
pieInnerRadius="0.3"
pieLabelRadius="0.6"
pieLabelBackgroundColor="#555"
pieLabelBackgroundOpacity="0.7"
>
<s:iterator value="%{pieDataMap}">
<sjc:chartData
label="%{key}"
data="%{value}"
/>
</s:iterator>
</sjc:chart>
BackEnd:
Map<Integer, Integer> pieDataMap = new TreeMap<String, Integer>();
pieDataMap.put("Java", 18);
pieDataMap.put("C", 17);
pieDataMap.put("C++", 10);
pieDataMap.put("PHP", 8);
pieDataMap.put("(Visual) Basic", 6);
pieDataMap.put("C#", 5);