user1751287 user1751287 - 2 years ago 110
Javascript Question

chartjs custom y axis values, different text for each one

I am trying to change numeric values within y axis with custom text ones. I tried using loop but it takes only the first one.

callback:function(value) {
var value = ["January", "February", "March", "April", "May"];
for(i = 0; i < value.length; i++){
return value[i];


here is FIDDLE with the sample graph

maybe case of something ?

Answer Source

Try to return value from the array properly,

callback:function(value) { 
  var x = ["January", "February", "March", "April", "May", "June", "July"];
  return x[value | 0];                  


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download