score:11

Accepted answer

for version 2.x, yaxes labels are actually stored in the options of the chart, and not its data as you did.

if you take a look at the docs, you'll see that you have to edit the callback attributes of the ticks in options.scales.yaxes .


to do what you want, i just added a js object in your code :
// replace the value with what you actually want for a specific key
var ylabels = {
    0 : 'newb', 2 : 'codecademy', 4 : 'code-school', 6 : 'bootcamp', 8 : 'junior-dev',
    10 : 'mid-level', 12 : 'senior-dev', 14 : 'full-stack-dev', 16 : 'famous-speaker',
    18 : 'unicorn', 20 : 'harambe'
}

and then in the callback :

options: {
    scales: {
        yaxes: [{
            ticks: {
                callback: function(value, index, values) {
                    // for a value (tick) equals to 8
                    return ylabels[value];
                    // 'junior-dev' will be returned instead and displayed on your chart
                }
            }
        }]
    }
}

take a look at this jsfiddle for the result.


Related Query

More Query from same tag