[Chartjs]-Using chartjs v2 to show categorical values on axis instead of numeric

2👍

If you want to change just the tick labels use the callback property of ticks. For example

...
options: {
  scales: {
    yAxes: [{
      ticks: {
        callback: function(value) {
          if (value === 20)
            return 'Low';
          else if (value === 50)
            return 'Medium';
          else if (value === 80)
            return 'High';
          else
            return '';
        }
      }
    }]
  }
}

Fiddle – http://jsfiddle.net/1gfu0tfg/

Leave a comment