From: Mattias Lyckne Date: Fri, 18 Dec 2015 15:18:49 +0000 (+0100) Subject: disable autoSkip when there is a userCallback or autoSkip is set to false X-Git-Tag: 2.0.0-beta2~12^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23b2d991f7a6ec199c952f490ef906713398a1df;p=thirdparty%2FChart.js.git disable autoSkip when there is a userCallback or autoSkip is set to false --- diff --git a/src/core/core.scale.js b/src/core/core.scale.js index 6f15033e6..aa8b79d3e 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -46,6 +46,7 @@ padding: 10, reverse: false, display: true, + autoSkip: true, callback: function(value) { return '' + value; }, @@ -403,6 +404,11 @@ var skipRatio; var scaleLabelX; var scaleLabelY; + var useAutoskipper = this.options.ticks.autoSkip; + + if(this.options.ticks.userCallback) { + useAutoskipper = false; + } // Make sure we draw text in the correct color and font this.ctx.fillStyle = this.options.ticks.fontColor; @@ -418,6 +424,10 @@ skipRatio = 1 + Math.floor(((this.options.ticks.fontSize + 4) * this.ticks.length) / (this.width - (this.paddingLeft + this.paddingRight))); } + if (!useAutoskipper) { + skipRatio = false; + } + helpers.each(this.ticks, function(label, index) { // Blank ticks if ((skipRatio > 1 && index % skipRatio > 0) || (label === undefined || label === null)) {