數據綁定我是很新,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);
在網站上做工精細的其他例子。
在此先感謝 - 任何想法,將不勝感激。