From 956d9d546d91156a24d76ec90e0f1dfe696a8973 Mon Sep 17 00:00:00 2001 From: Marcel Bruse Date: Fri, 25 Sep 2015 22:42:21 +0200 Subject: [PATCH] Now textFormatted(v) returns a string in any case If no format is defined and argument v is a Number, then this Number will be returned as it is. For instance, this can be the case if your min value on the y axis is 0 (zero). This causes the attempt to read text.length in getSizeFor1Char(tick) to fail, since length is undefined for a Number. This in turn leads to a failed detection of the height and width of the tick text, which is important if you want to increase the font size of the tick text via CSS. --- src/c3.axis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c3.axis.js b/src/c3.axis.js index 6d4f7a3..a296c1d 100644 --- a/src/c3.axis.js +++ b/src/c3.axis.js @@ -49,7 +49,7 @@ function c3_axis(d3, params) { } function textFormatted(v) { var formatted = tickFormat ? tickFormat(v) : v; - return typeof formatted !== 'undefined' ? formatted : ''; + return typeof formatted !== 'undefined' ? formatted.toString() : ''; } function getSizeFor1Char(tick) { if (tickTextCharSize) {