From: Evert Timberg Date: Mon, 15 Feb 2016 15:43:19 +0000 (-0500) Subject: When the last label would overlap with the previously shown label, skip the previousl... X-Git-Tag: v2.0.0~39^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2017%2Fhead;p=thirdparty%2FChart.js.git When the last label would overlap with the previously shown label, skip the previously shown one --- diff --git a/src/core/core.scale.js b/src/core/core.scale.js index 3e754afcc..a7475f1b8 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -484,7 +484,9 @@ module.exports = function(Chart) { helpers.each(this.ticks, function(label, index) { // Blank ticks var isLastTick = this.ticks.length === index + 1; - var shouldSkip = skipRatio > 1 && index % skipRatio > 0; + + // Since we always show the last tick,we need may need to hide the last shown one before + var shouldSkip = (skipRatio > 1 && index % skipRatio > 0) || (index % skipRatio === 0 && index + skipRatio > this.ticks.length); if (shouldSkip && !isLastTick || (label === undefined || label === null)) { return; }