Chartjs-How to remove zero values labels using chartjs-plugins-datalabels

0๐Ÿ‘

โœ…

You can define a formatter as shown below. The function returns an empty string if the value is zero, the value itself otherwise.

plugins:{
  datalabels: {
    align: 'end',
    anchor: 'end',
    formatter: v => v ? v : ''
  }
}

For further details, please consult Custom Labels from the chartjs-plugin-datalabels documentation.

0๐Ÿ‘

Change zeros to undefined or null

enter image description here

Leave a comment