Chartjs Remove Decimal Value From Axes Tick Value

March 21, 2020
Don’t Show 0.5, 1.5, 2.5 etc
new Chart(ctx, {
  options: {
      scales: {
        yAxes: [
          {
            ticks: {
              userCallback(label, index, labels) {
                 // only show if whole number
                 if (Math.floor(label) === label) {
                     return label;
                 }
              },
            }
          }
         ],
      },
    }
  }
})
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.