Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
http://jsfiddle.net/BhrpA/1/embedded/result/
为什么图形没有扩展完整的 789px?(黑色容器 div 的宽度)
SVG 元素是 789,但最右边有 100px 左右的黑色空间。
谢谢!
您的 x 域设置不正确。由于数组是基于 0 的,因此您的最大索引length-1不是length. 因此,如果您将其更改为:
length-1
length
x=d3.scale.linear().domain([0,data.length-1]).range([0,w])
您会看到它现在按预期完成了全长。