Merge pull request #2017 from nnnick/fix/1884

When the last label would overlap with the previously shown label, skip the previously shown one
This commit is contained in:
Evert Timberg 2016-02-15 10:49:59 -05:00
commit c3149a9400

View File

@ -484,7 +484,9 @@ module.exports = function(Chart) {
helpers.each(this.ticks, function(label, index) { helpers.each(this.ticks, function(label, index) {
// Blank ticks // Blank ticks
var isLastTick = this.ticks.length === index + 1; 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)) { if (shouldSkip && !isLastTick || (label === undefined || label === null)) {
return; return;
} }