Chartjs-Chart.js change vertical position of points

1👍

Just add the following at the end of your buildScale

...
var scale = this.scale;
var originalCalculateY = scale.calculateY;
scale.calculateY = function(y) {
    if (y > scale.max)
        return originalCalculateY.apply(this, [scale.max]);
    else if (y < scale.min)
        return originalCalculateY.apply(this, [scale.min]);
    else
        return originalCalculateY.apply(this, [y]);
}
...

It would a bit confusing because you’d still have the axis labels.


Fiddle – http://jsfiddle.net/wjb3k4gx/

Leave a comment