d3 objects do not render within svg bounds on IE10

2019-07-26 18:07发布

As shown in the image, a circle drawn with center at 0,0 displays correctly on chrome, but on IE10 it overflows the SVG bounds. What do I need to do to get this to render correctly on IE?

D3 rendering in IE and Chrome

Here is the code:

<body>
  <div id="chart1">
  </div>
    <script>
      var width = 50,height = 50;
      var SVGmap = d3.select("#chart1")
                      .append("svg")
                      .attr("width", width)
                      .attr("height", height);

      var g = SVGmap.append("g");
      g.append("circle") 
        .style("stroke", "gray")
        .style("fill", "red")
        .attr("r", 40)
        .attr("cx", 0)
        .attr("cy", 0)

    </script> 
</body> 

标签: svg d3.js
1条回答
在下西门庆
2楼-- · 2019-07-26 18:31

Thanks Robert. Adding .attr("overflow", "hidden") to the SVG Element solves this.

查看更多
登录 后发表回答