From 97da3347beb1785e2dce0ae3433f0225c7161bd2 Mon Sep 17 00:00:00 2001 From: Pascal Richier Date: Sat, 7 Nov 2015 01:37:09 +0100 Subject: [PATCH] Add options.ticks.maxTicksLimit To be able to change default '11' value --- src/scales/scale.linear.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scales/scale.linear.js b/src/scales/scale.linear.js index ac8954fa1..ef7db5b6f 100644 --- a/src/scales/scale.linear.js +++ b/src/scales/scale.linear.js @@ -125,10 +125,12 @@ 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