[Chartjs]-Chart.js doughnut text colors

0👍

Realized the text color inside the donuts, while affected by the secondary color, was actually painted using canvas.fillText(). As such, all I needed was to add .fillStyle = “whatever” and it works.

0👍

Change

    var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Doughnut(pieData,{percentageInnerCutout : 80});

by

    var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Doughnut(pieData,doughnutOptions);

You can find all the available options here http://www.chartjs.org/docs/#getting-started-global-chart-configuration

For you color text you can add this option

var doughnutOptions= {
 scaleLabel: '<p style="color: red"><%=value%></p>'
}

Change style="color: red" by the color you want

Leave a comment