How to add percentage after value data in chart

👍:0

You need to define a tooltips.callback.label function as shown below. For further details please consult Chart.js v. 2.8.0 documentation here.

options: {
  ...
  tooltips: {
    callbacks: {
      label: (tooltipItem, data) => data.datasets[0].data[tooltipItem.index] + '%'
    }
  },
  ...

Please note that you’re using a rather old version of Chart.js, the today latest stable version is 3.7.0.

Leave a comment