From 057a31783e5f14b5999e727b9582f68809d5c645 Mon Sep 17 00:00:00 2001 From: Chris Hallson Date: Fri, 26 Sep 2014 12:06:58 +0100 Subject: [PATCH] #587 Graph labeling issue Large graph labels could cause wrapping inside the tick tags adding to determine maximum size, adding to svg element instead of html fixes this issue. --- src/axis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axis.js b/src/axis.js index e024cc8..6fcef01 100644 --- a/src/axis.js +++ b/src/axis.js @@ -255,7 +255,7 @@ c3_chart_internal_fn.getMaxTickWidth = function (id) { scale = $$.x.copy().domain($$.getXDomain(targetsToShow)); axis = $$.getXAxis(scale, $$.xOrient, $$.getXAxisTickFormat(), config.axis_x_tick_values ? config.axis_x_tick_values : $$.xAxis.tickValues()); } - $$.d3.select('body').append("g").style('visibility', 'hidden').call(axis).each(function () { + $$.svg.append("g").style('visibility', 'hidden').call(axis).each(function () { $$.d3.select(this).selectAll('text').each(function () { var box = this.getBoundingClientRect(); if (maxWidth < box.width) { maxWidth = box.width; }