【发布时间】:2019-04-08 17:14:24
【问题描述】:
如何使用 chartjs-plugin-datalabels 在 Chart.JS 圆环图中永久显示自定义标签?
这个例子现在看起来像这样:
在https://chartjs-plugin-datalabels.netlify.com/guide/formatting.html#data-transformation下,我发现下面的代码应该把标签改成自定义格式:
formatter: function(value, context) {
return context.dataIndex + ': ' + Math.round(value*100) + '%';
}
为什么这在示例小提琴中不起作用:https://jsfiddle.net/o4kyt69j/1/?
【问题讨论】:
标签: javascript chart.js