]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
disable autoSkip when there is a userCallback or autoSkip is set to false
authorMattias Lyckne <mattias@lyckne.se>
Fri, 18 Dec 2015 15:18:49 +0000 (16:18 +0100)
committerMattias Lyckne <mattias@lyckne.se>
Fri, 18 Dec 2015 15:18:49 +0000 (16:18 +0100)
src/core/core.scale.js

index 6f15033e69ae6a4b00fd1cbd4d51cfa14df70daa..aa8b79d3e0451d223b5be22f7a23442f87d0313f 100644 (file)
@@ -46,6 +46,7 @@
                        padding: 10,
                        reverse: false,
                        display: true,
+                       autoSkip: true,
                        callback: function(value) {
                                return '' + value;
                        },
                                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;
                                                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)) {