Browse Source

Fix legend spec

pull/654/head
Masayuki Tanaka 10 years ago
parent
commit
60c1416088
  1. 2
      c3.js
  2. 4
      c3.min.js
  3. 6
      spec/legend-spec.js
  4. 2
      src/text.js

2
c3.js

@ -3091,7 +3091,7 @@
.style("fill-opacity", opacityForText));
};
c3_chart_internal_fn.getTextRect = function (text, cls) {
var svg = this.d3.select('body').append("svg").style('visibility', 'hidden'), rect;
var svg = this.d3.select('body').attr('class', 'c3').append("svg").style('visibility', 'hidden'), rect;
svg.selectAll('.dummy')
.data([text])
.enter().append('text')

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

6
spec/legend-spec.js

@ -23,7 +23,9 @@ describe('c3 chart legend', function () {
}
chart = window.c3.generate(args);
d3 = chart.internal.d3;
chart.internal.d3.select('.jasmine_html-reporter').style('display', 'none');
chart.internal.d3.select('.jasmine_html-reporter')
.style('position', 'absolute')
.style('right', 0);
window.setTimeout(function () {
done();
@ -34,7 +36,7 @@ describe('c3 chart legend', function () {
it('should be located on the center of chart', function () {
var box = chart.internal.legend.node().getBoundingClientRect();
expect(box.left + box.right).toBe(645);
expect(box.left + box.right).toBe(640);
});
});

2
src/text.js

@ -48,7 +48,7 @@ c3_chart_internal_fn.addTransitionForText = function (transitions, xForText, yFo
.style("fill-opacity", opacityForText));
};
c3_chart_internal_fn.getTextRect = function (text, cls) {
var svg = this.d3.select('body').append("svg").style('visibility', 'hidden'), rect;
var svg = this.d3.select('body').attr('class', 'c3').append("svg").style('visibility', 'hidden'), rect;
svg.selectAll('.dummy')
.data([text])
.enter().append('text')

Loading…
Cancel
Save