formatter: function (value, context) {
var result = value
.toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
var index = context.dataIndex;
var fontWeight = index === 0 ? 700 : 500;
return {
value: result,
font: {
weight: fontWeight,
},
};
return result;
},
Chart.js (2.9.4) + Chartjs-datalabels plugin (0.7.0) in use.
Currently, I want to change the label font-weight value of the 0th index to bold.
Label values are output as [object object] values due to the lower return result.
Can I get some advice?
Top comments (0)