[Chartjs]-How to show decimals with 0 in chartJS

1👍

You will need to format your tooltips value as a string, this can be achieved by adding a label formatter using .toFixed() (Documentation) into the options:

plugins: {
  tooltip: {
    callbacks: {
      label: function(context) {
        // This guarantees that 1 decimal place is shown
        return context.parsed.y.toFixed(1);
      }
    }
  }
}

Forked version of your codesandbox showing this in action.

Leave a comment