1π
β
To achieve expected result, use below option of changing value to string using toString() and then just return value bases on length
callback: value => {
if (value.toString().length > 15) {
return value.toString().substr(0, 15) + '...'; //truncate
} else {
return value
}
}
code example for reference β https://codepen.io/nagasai/pen/zaLVeO
Note: Check the padding values in the options, check this link for more details β Chart.js y axis labels are truncated incase of missing truncated values due to padding
Source:stackexchange.com