From f34fb193d167759b8b858b6f1f834804ceb927f4 Mon Sep 17 00:00:00 2001 From: Christian Kalmar Date: Sat, 2 Aug 2014 12:42:05 +0200 Subject: [PATCH 1/3] allow for tickValues to be calculated dynamically via a function by providing the current domain --- c3.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 0962045..7207a5d 100644 --- a/c3.js +++ b/c3.js @@ -5558,8 +5558,15 @@ return axis; }; axis.tickValues = function (x) { - if (!arguments.length) { return tickValues; } - tickValues = x; + if (typeof x === 'function') { + tickValues = function() { + return x(scale.domain()); + } + } + else { + if (!arguments.length) { return tickValues; } + tickValues = x; + } return axis; }; return axis; From fc79218d49b9a5fcad2bc552f302dadc39de1f50 Mon Sep 17 00:00:00 2001 From: Christian Kalmar Date: Sat, 2 Aug 2014 16:26:36 +0200 Subject: [PATCH 2/3] jshint fix --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 7207a5d..4b7a748 100644 --- a/c3.js +++ b/c3.js @@ -5559,7 +5559,7 @@ }; axis.tickValues = function (x) { if (typeof x === 'function') { - tickValues = function() { + tickValues = function () { return x(scale.domain()); } } From 80c3c29a04585abd28c86bf2aad4c5a8e4164371 Mon Sep 17 00:00:00 2001 From: Christian Kalmar Date: Sat, 2 Aug 2014 16:30:07 +0200 Subject: [PATCH 3/3] jshint fix --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 4b7a748..1b5173f 100644 --- a/c3.js +++ b/c3.js @@ -5561,7 +5561,7 @@ if (typeof x === 'function') { tickValues = function () { return x(scale.domain()); - } + }; } else { if (!arguments.length) { return tickValues; }