Paul's Programming Notes     Archive     Feed     Github

Change Percent To Numbers and Keep Color - Flot Pie Chart

You can access the color of the section of the pie chart by using “series.color”:

options = {
series: {
pie: {
innerRadius: 0.5,
show: true,
label: {
show: true,
formatter: function (label, series) {
console.log(series);
return '<div style="font-size:8pt;text-align:center;padding:2px; color: ' + series.color +';">' + label + '<br/>' + series.data[0][1] + '</div>';
},
}
}
},
};
view raw flotpie.js hosted with ❤ by GitHub