Commit b8cc8903 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix legend overlap on Firefox - #1026 #1019

parent 4140ceb2
...@@ -3248,7 +3248,8 @@ ...@@ -3248,7 +3248,8 @@
}; };
c3_chart_internal_fn.getTextRect = function (text, cls) { c3_chart_internal_fn.getTextRect = function (text, cls) {
var body = this.d3.select('body').classed('c3', true), var body = this.d3.select('body').classed('c3', true),
svg = body.append("svg").style('visibility', 'hidden').style('height', 0), rect; // height = 1 is needed to get rect on Firefox - #1026
svg = body.append("svg").style('visibility', 'hidden').style('height', 1), rect;
svg.selectAll('.dummy') svg.selectAll('.dummy')
.data([text]) .data([text])
.enter().append('text') .enter().append('text')
...@@ -4369,7 +4370,8 @@ ...@@ -4369,7 +4370,8 @@
$$.updateXAxisTickValues(targetsToShow, axis); $$.updateXAxisTickValues(targetsToShow, axis);
} }
body = this.d3.select('body').classed('c3', true); body = this.d3.select('body').classed('c3', true);
svg = body.append('svg').style('visibility', 'hidden').style('height', 0); // height = 1 is needed to get rect on Firefox - #1026
svg = body.append('svg').style('visibility', 'hidden').style('height', 1);
svg.append('g').call(axis).each(function () { svg.append('g').call(axis).each(function () {
$$.d3.select(this).selectAll('text tspan').each(function () { $$.d3.select(this).selectAll('text tspan').each(function () {
var box = this.getBoundingClientRect(); var box = this.getBoundingClientRect();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -290,7 +290,8 @@ c3_chart_internal_fn.getMaxTickWidth = function (id, withoutRecompute) { ...@@ -290,7 +290,8 @@ c3_chart_internal_fn.getMaxTickWidth = function (id, withoutRecompute) {
$$.updateXAxisTickValues(targetsToShow, axis); $$.updateXAxisTickValues(targetsToShow, axis);
} }
body = this.d3.select('body').classed('c3', true); body = this.d3.select('body').classed('c3', true);
svg = body.append('svg').style('visibility', 'hidden').style('height', 0); // height = 1 is needed to get rect on Firefox - #1026
svg = body.append('svg').style('visibility', 'hidden').style('height', 1);
svg.append('g').call(axis).each(function () { svg.append('g').call(axis).each(function () {
$$.d3.select(this).selectAll('text tspan').each(function () { $$.d3.select(this).selectAll('text tspan').each(function () {
var box = this.getBoundingClientRect(); var box = this.getBoundingClientRect();
......
...@@ -49,7 +49,8 @@ c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTra ...@@ -49,7 +49,8 @@ c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTra
}; };
c3_chart_internal_fn.getTextRect = function (text, cls) { c3_chart_internal_fn.getTextRect = function (text, cls) {
var body = this.d3.select('body').classed('c3', true), var body = this.d3.select('body').classed('c3', true),
svg = body.append("svg").style('visibility', 'hidden').style('height', 0), rect; // height = 1 is needed to get rect on Firefox - #1026
svg = body.append("svg").style('visibility', 'hidden').style('height', 1), rect;
svg.selectAll('.dummy') svg.selectAll('.dummy')
.data([text]) .data([text])
.enter().append('text') .enter().append('text')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment