From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 24 Oct 2019 23:21:05 +0000 (-0700) Subject: Fix autoskip for first segment of chart (#6584) X-Git-Tag: v2.9.0~1^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c9f202c6835d60fbaa220cbfab99b9946aae999;p=thirdparty%2FChart.js.git Fix autoskip for first segment of chart (#6584) * Fix autoskip for first segment of chart * Fix issue identified during review --- diff --git a/src/core/core.scale.js b/src/core/core.scale.js index b4553a86a..f292bd2c2 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -305,6 +305,12 @@ function skip(ticks, spacing, majorStart, majorEnd) { } next = start; + + while (next < 0) { + count++; + next = Math.round(start + count * spacing); + } + for (i = Math.max(start, 0); i < end; i++) { tick = ticks[i]; if (i === next) {