mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 20:29:12 +02:00
disable autoSkip when there is a userCallback or autoSkip is set to false
This commit is contained in:
parent
3ccf3fd249
commit
23b2d991f7
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user