Chart DesignUser-Defined Color in Pie Chart

VIEW MORE FEATURES
VIEW HTML
EDIT ON CODEPEN
In this example, a user-defined javascript function is used to fill colors in the slices of a pie chart.
<Pie2DSeries field="Profit" nameField="Month" labelJsFunction="labelJsFunc" fillJsFunction="fillJsFunc" styleName="seriesStyle">

function fillJsFunc (seriesId, index, data, values) {
if (values[0] > 2000)
return "#de4540";
else if (values[0] > 1800)
return "#f0584e";
else if (values[0] > 1600)
return "#f56b49";
else if (values[0] > 1400)
return "#f87a41";
else if (values[0] > 1200)
return "#fa8939";
else
return "#ffa158";
}