Browse Source

Fix legend overlap on Firefox - #1026 #1019

pull/1053/head
Masayuki Tanaka 10 years ago
parent
commit
b8cc89034e
  1. 6
      c3.js
  2. 2
      c3.min.js
  3. 3
      src/axis.js
  4. 3
      src/text.js

6
c3.js

@ -3248,7 +3248,8 @@
};
c3_chart_internal_fn.getTextRect = function (text, cls) {
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')
.data([text])
.enter().append('text')
@ -4369,7 +4370,8 @@
$$.updateXAxisTickValues(targetsToShow, axis);
}
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 () {
$$.d3.select(this).selectAll('text tspan').each(function () {
var box = this.getBoundingClientRect();

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

3
src/axis.js

@ -290,7 +290,8 @@ c3_chart_internal_fn.getMaxTickWidth = function (id, withoutRecompute) {
$$.updateXAxisTickValues(targetsToShow, axis);
}
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 () {
$$.d3.select(this).selectAll('text tspan').each(function () {
var box = this.getBoundingClientRect();

3
src/text.js

@ -49,7 +49,8 @@ c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTra
};
c3_chart_internal_fn.getTextRect = function (text, cls) {
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')
.data([text])
.enter().append('text')

Loading…
Cancel
Save