答案 0 :(得分:4)
Chart.js的两个选项:
<强> 1。使用data labels plugin:
plugins: {
datalabels: {
color: 'red',
align: 'top',
anchor: 'end',
formatter: function(value, context) {
console.log(context)
if (value>70)
return "("+context.dataIndex + '): ' + value;
else
return "";
}
}
}
示例:http://jsfiddle.net/beaver71/wo2cd3jf/
<强> 2。使用annotation plugin:
annotation: {
drawTime: 'afterDatasetsDraw',
annotations: annotations_array
}