Chartjs-Chart JS Custom Labels don't work

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

Leave a comment