chart.js issue.. plz nn
FE-yhchoi
Posted on February 16, 2023
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?
💖 💪 🙅 🚩
FE-yhchoi
Posted on February 16, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.