From: Tore Lervik Date: Mon, 21 Dec 2015 22:30:40 +0000 (+0100) Subject: Refactored skipRatio to use the longest label text for calculation. X-Git-Tag: 2.0.0-beta2~9^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd024349434e10822e52ca7d42d634c4644695d8;p=thirdparty%2FChart.js.git Refactored skipRatio to use the longest label text for calculation. --- diff --git a/src/core/core.scale.js b/src/core/core.scale.js index 3269fe118..2ef412ba3 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -454,8 +454,8 @@ var yTickEnd = this.options.position === "bottom" ? this.top + 10 : this.bottom; skipRatio = false; - if ((this.options.ticks.fontSize + 4) * this.ticks.length > (this.width - (this.paddingLeft + this.paddingRight))) { - skipRatio = 1 + Math.floor(((this.options.ticks.fontSize + 4) * this.ticks.length) / (this.width - (this.paddingLeft + this.paddingRight))); + if ((this.options.ticks.fontSize * maxLength) * this.ticks.length > (this.width - (this.paddingLeft + this.paddingRight))) { + skipRatio = 1 + Math.floor((((this.options.ticks.fontSize * maxLength / 2) + (this.options.ticks.autoSkipPadding || 20)) * this.ticks.length) / (this.width - (this.paddingLeft + this.paddingRight))); } if (!useAutoskipper) {