Browse Source

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.
pull/1395/head
Marcel Bruse 9 years ago
parent
commit
956d9d546d
  1. 2
      src/c3.axis.js

2
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) {

Loading…
Cancel
Save