Chartjs-Custom y axle using Chart.js

0πŸ‘

βœ…

Yes, what you are wanting is possible. You just need to use the scale ticks.callback option. Here is an example.

scales: {
  yAxes: [{
    ticks: {
      callback: function(value) {
        if (value === 25) {
          return "Half";
        } else if (value === 50) {
          return "Full";
        }
      }
    }
  ]}
}

0πŸ‘

There is options in chartJS that helps you to scale your Y Axis :

Here is an example :

   {
        scaleSteps: 3,
        scaleStepWidth: 1,
        scaleStartValue: 0,
    }

and this gives you :

enter image description here

So for the half step you use : scaleStepWidth: 0.5

Leave a comment