[Chartjs]-ChartJS 3.0 – Number format

1πŸ‘

βœ…

The ticks have a callback section which receives 3 arguments, the current value, the index of the tick and all the ticks.

Here you can transform the value to scientific notation yourself like so

scales:{
  y: {
    ticks: {
      callback: function (val, index, ticks) {
         return Number.parseFloat(val).toExponential(2); // limit to 2 decimal numbers
       }
    }
  }
}

Leave a comment