]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add options.ticks.maxTicksLimit
authorPascal Richier <pascoual@users.noreply.github.com>
Sat, 7 Nov 2015 00:37:09 +0000 (01:37 +0100)
committerPascal Richier <pascoual@users.noreply.github.com>
Sat, 7 Nov 2015 00:37:09 +0000 (01:37 +0100)
To be able to change default '11' value

src/scales/scale.linear.js

index ac8954fa1208ceefbc0049002c99cddf2bff7e87..ef7db5b6fef1f76d5734a56b0f1a467d96162767 100644 (file)
                        var maxTicks;
 
                        if (this.isHorizontal()) {
-                               maxTicks = Math.min(11, Math.ceil(this.width / 50));
+                               maxTicks = Math.min(this.options.ticks.maxTicksLimit ? this.options.ticks.maxTicksLimit : 11,
+                                                   Math.ceil(this.width / 50));
                        } else {
                                // The factor of 2 used to scale the font size has been experimentally determined.
-                               maxTicks = Math.min(11, Math.ceil(this.height / (2 * this.options.ticks.fontSize)));
+                               maxTicks = Math.min(this.options.ticks.maxTicksLimit ? this.options.ticks.maxTicksLimit : 11,
+                                                   Math.ceil(this.height / (2 * this.options.ticks.fontSize)));
                        }
 
                        // Make sure we always have at least 2 ticks