]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
When the last label would overlap with the previously shown label, skip the previousl... 2017/head
authorEvert Timberg <evert.timberg@gmail.com>
Mon, 15 Feb 2016 15:43:19 +0000 (10:43 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Mon, 15 Feb 2016 15:43:19 +0000 (10:43 -0500)
src/core/core.scale.js

index 3e754afcc223262ef1136d959f15ec0c2260e5aa..a7475f1b8e021c7541c749da2f29a498ef08151f 100644 (file)
@@ -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;
                                                }