1
我下面的圆圈example:如何使圆圈使用d3过渡一个接一个出现?
我创建下面的圆圈,我愿不透明转变是随着数据集的更新,圆将开始接连出现。例如,如果数据长度为5,则出现圆1,然后出现圆2,...最后出现圆5.如果数据更新为长度为2,则出现圆1,然后出现圆2。我该如何做到这一点?到目前为止,transition()对数据集统一起作用。
circle.enter().append("circle")
.attr("class", "dot");
// Update (set the dynamic properties of the elements)
circle
.attr("r", 5)
.attr("cy", 20)
.attr("cx", function(d,i){return i*50;})
.attr("fill", "red");
svg.selectAll("circle")
.style("opacity", 0)
.transition()
.duration(1000)
.style("opacity", 1);
这种方法是正确的,这里是小提琴http://jsfiddle.net/a2QpA/313/ – echonax