Javascript d3如何在不使用foreignObject的情况下在svg上添加表?
我正在使用下表Javascript d3如何在不使用foreignObject的情况下在svg上添加表?,javascript,d3.js,Javascript,D3.js,我正在使用下表 var table = svg.append("foreignObject") .attr("y",0) .attr("width", "100%") .attr("height", "50%") .append("xhtml:body") table.append("table") table.append('thead').append('tr') .selectAll('th') .data(scope.columns).enter() .append('
var table = svg.append("foreignObject")
.attr("y",0)
.attr("width", "100%")
.attr("height", "50%")
.append("xhtml:body")
table.append("table")
table.append('thead').append('tr')
.selectAll('th')
.data(scope.columns).enter()
.append('th')
.attr('class', function(d) {
return d.cl;
})
.text(function(d) {
return d.head;
});
// append body rows
table.append('tbody')
.selectAll('tr')
.data(scope.movies).enter()
.append('tr')
.selectAll('td')
.data(function(row, i) {
// evaluate column objects against the current row
return scope.columns.map(function(c) {
var cell = {};
d3.keys(c).forEach(function(k) {
cell[k] = typeof c[k] == 'function' ? c[k](row, i) : c[k];
});
return cell;
});
}).enter()
.append('td')
.html(function(d) {
return d.html;
})
.attr('class', function(d) {
return d.cl;
});
这在Chrome和firefox中非常有效。在IE11中,无法显示该表
如我所见,foreignObject在IE上不起作用。不使用foreignObject怎么办
感谢您的帮助。(附言:我希望你不要介意我的英语,它太差了。)可能是重复的可能是重复的