score:4

Accepted answer

1.as you can see on the left i have a strange 0.150000000000000000000002 value

the original axis label function had code to round the label to the number of decimal points in the stepvalue. i couldn't see it in the new one. however you can easily fix it by changing the template string

labels: {
    template: "<%= number(value.tofixed(2)) + ' a'%>",

or by replacing it with a callback function to format the number as you wish

labels: {
    usercallback: function (tick) {
        return number(tick.tofixed(2)) + ' a';
    },

2.top y-axis labels are cutted

there is already a bug logged for this - https://github.com/nnnick/chart.js/issues/1274 and it's part of the 2.0 milestone. so it should be fixed before the final 2.0 release.

till then you can easily work around it by adding some top padding to the canvas parent (and styling the wrapper instead of the canvas - background-color, border...)


fiddle - https://jsfiddle.net/fonvw25m/

score:2

i ran into the same problem with version: 2.1.6.

potatopeelings' updated solution looks like this:

    var options = {
        scales: {
            yaxes: [{
                ticks: {
                    callback: function (value, index, values) {
                        return parsefloat(value).tofixed(2) + '%';
                    }
                }
            }]
        }
    };

Related Query

More Query from same tag