How to render Text inside the doughnut chart, I am using ChartJs.
Advertisement
Answer
You have to modify the code like:
in chart.Doughnut.defaults
JavaScript
x
5
1
labelFontFamily : "Arial",
2
labelFontStyle : "normal",
3
labelFontSize : 24,
4
labelFontColor : "#666"
5
and then in function drawPieSegments
ctx.fillText(data[0].value + "%", width/2 - 20, width/2, 200);
See this pull: https://github.com/nnnick/Chart.js/pull/35
here is a fiddle http://jsfiddle.net/mayankcpdixit/6xV78/ implementing the same.