disable autoSkip when there is a userCallback or autoSkip is set to false

This commit is contained in:
Mattias Lyckne 2015-12-18 16:18:49 +01:00
parent 3ccf3fd249
commit 23b2d991f7

View File

@ -46,6 +46,7 @@
padding: 10,
reverse: false,
display: true,
autoSkip: true,
callback: function(value) {
return '' + value;
},
@ -403,6 +404,11 @@
var skipRatio;
var scaleLabelX;
var scaleLabelY;
var useAutoskipper = this.options.ticks.autoSkip;
if(this.options.ticks.userCallback) {
useAutoskipper = false;
}
// Make sure we draw text in the correct color and font
this.ctx.fillStyle = this.options.ticks.fontColor;
@ -418,6 +424,10 @@
skipRatio = 1 + Math.floor(((this.options.ticks.fontSize + 4) * this.ticks.length) / (this.width - (this.paddingLeft + this.paddingRight)));
}
if (!useAutoskipper) {
skipRatio = false;
}
helpers.each(this.ticks, function(label, index) {
// Blank ticks
if ((skipRatio > 1 && index % skipRatio > 0) || (label === undefined || label === null)) {