selectAll + data + enter + append が最初は正常に機能する理由を誰かが説明できますが、もう一度呼び出すと、単一の要素のみが追加されますか?
http://jsfiddle.net/scottieb/wQJen/
私が走るとき
vis.selectAll("circle")
.data(datafiltered).enter().append("svg:circle")
.attr("cx", function(d) { return x(d.x)})
.attr("cy", function(d) { return y(d.y)})
.attr("fill", "red").attr("r", 15);
4 つのポイントを取得します (「datafiltered.」の 4 つのデータ ペアに対応)。しかし、ボタンをクリックすると、実行されます
vis.selectAll("circle")
.data(datafiltered2)
.enter().append("svg:circle")
.attr("cx", function(d) {
return x(d.x)
}).attr("cy", function(d) {
return y(d.y)
}).attr("fill", "black").attr("r", 5);
'datafiltered2' の最後の要素 (この 5 つのペア) のみを追加します。したがって、データは異なり、ボタンをクリックすると2番目のデータが発生しますが、なぜ1ポイントしか追加されないのかわかりません!