From cd024349434e10822e52ca7d42d634c4644695d8 Mon Sep 17 00:00:00 2001 From: Tore Lervik Date: Mon, 21 Dec 2015 23:30:40 +0100 Subject: [PATCH] Refactored skipRatio to use the longest label text for calculation. --- src/core/core.scale.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {