0👍
I just found the answer, I edited the else{} block under verticalLabel function:
function verticalLabel(ctx, data, dataToSplit, topOffset, spaceBetween, commaGap, why_pos) {
var i = 0, prev = 0;
for (x of dataToSplit.toString().split("").reverse()) {
if (x.indexOf(",") > -1) {
ctx.fillText(x, data.x + commaGap, prev - topOffset / why_pos);
} else {
ctx.fillText(x, data.x, why_pos - spaceBetween * i - topOffset / why_pos);
i++;
}
var prev = data.y - spaceBetween * i;
}
}
my code under animation: {}
if ((scale_max - model.y) / scale_max >= 0.60)
y_pos = model.y + 90;
verticalLabel(ctx, model, addCommas(dataset.data[i]), 50, 20, 4, y_pos);
It is somehow working but still not perfect. I LOST the COMMAS when inserted inside the bar graph. I still need help.
- Chartjs-How can I set 3 color to the same chartjs bar?
- Chartjs-Overlay loading indicator before data and charts are loaded
Source:stackexchange.com