【发布时间】:2015-11-07 11:52:35
【问题描述】:
【问题讨论】:
-
谢谢。查看jfire.io/animations 获取大量酷炫的 d3 动画艺术
-
不知道那个网站,太棒了:) 谢谢
标签: javascript d3.js
【问题讨论】:
标签: javascript d3.js
为您的 SVG 元素设置 width=100% 和 height=100% 以及 viewBox 和 preserveAspectRatio 属性。
以下解决方案将为您指明方向,
var svg = d3.select('#chart').append("svg")
.attr("width", '100%')
.attr("height", '100%')
.attr('viewBox','0 0 '+Math.min(width,height)+' '+Math.min(width,height))
.attr('preserveAspectRatio','xMinYMin')
.append("g") ;
【讨论】: