]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix autoskip for first segment of chart (#6584)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Thu, 24 Oct 2019 23:21:05 +0000 (16:21 -0700)
committerEvert Timberg <evert.timberg+github@gmail.com>
Thu, 24 Oct 2019 23:21:05 +0000 (19:21 -0400)
* Fix autoskip for first segment of chart

* Fix issue identified during review

src/core/core.scale.js

index b4553a86afdf98f705af7c626f21e1162c977683..f292bd2c2e5c56016bcf1cb7d451a45d2e217dd2 100644 (file)
@@ -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) {