Browse Source

Fix parent width - #241

pull/246/head
Masayuki Tanaka 11 years ago
parent
commit
a3c1b7dd15
  1. 14
      c3.js
  2. 6
      c3.min.js

14
c3.js

@ -541,9 +541,19 @@
if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; }
return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0);
}
function getParentRectValue(key) {
var parent = selectChart.node(), v;
while (parent && parent.tagName !== 'BODY') {
v = parent.getBoundingClientRect()[key];
if (v) {
break;
}
parent = parent.parentNode;
}
return v;
}
function getParentWidth() {
var w = selectChart.style("width");
return w.indexOf('px') > 0 ? +w.replace('px', '') : 0;
return getParentRectValue('width');
}
function getParentHeight() {
var h = selectChart.style('height');

6
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save