数据绑定我是很新,D3和一直跟着教程:http://christopheviau.com/d3_tutorial/从教程例如
我卡上的“数据绑定”的例子 - 它非常简单,但代码是不会产生任何东西。我在这里探索,并没有找到列出的问题,所以我想我会问。
下面的代码:
var dataset = [],
i = 0;
for(i = 0; i < 5; i++) {
dataset.push(Math.round(Math.random() * 100));
}
var sampleSVG = d3.select("#viz")
.append("svg")
.attr("width", 400)
.attr("height", 75);
sampleSVG.selectAll("circle")
.data(dataset)
.enter().append("circle")
.style("stroke", "gray")
.style("fill", "white")
.attr("height", 40)
.attr("width", 75)
.attr("x", function (d, i) {
return i * 80
})
.attr("y", 20);
在网站上做工精细的其他例子。
在此先感谢 - 任何想法,将不胜感激。