Skip to content

Commit c3149a9

Browse files
committed
Merge pull request #2017 from nnnick/fix/1884
When the last label would overlap with the previously shown label, skip the previously shown one
2 parents 2672efa + 4c35bba commit c3149a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/core.scale.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,9 @@ module.exports = function(Chart) {
484484
helpers.each(this.ticks, function(label, index) {
485485
// Blank ticks
486486
var isLastTick = this.ticks.length === index + 1;
487-
var shouldSkip = skipRatio > 1 && index % skipRatio > 0;
487+
488+
// Since we always show the last tick,we need may need to hide the last shown one before
489+
var shouldSkip = (skipRatio > 1 && index % skipRatio > 0) || (index % skipRatio === 0 && index + skipRatio > this.ticks.length);
488490
if (shouldSkip && !isLastTick || (label === undefined || label === null)) {
489491
return;
490492
}

0 commit comments

Comments
 (0)