我正试着在我的每个圈子里听取过渡事件的结束:
var n=0;
//drawing the plot
var circles = svg.selectAll("circle")
.data(dataset)
.enter()
.append("circle")
.attr("cx", function(d, i){return xScale(max-createDate(dataset[dataset.length-1-i]["Time"]));})
.attr("cy", -100)
.attr("r", 5)
.attr("fill", function(d){return d["Doping"]?"#ff1d25":"#009267";})
.each(function() { n++; console.log(n)})
.transition()
.delay(function(d,i){return i*50})
.duration(1500)
.attr("cy", function(d){return yScale(d["Place"]);})
.each('end', function() {
n--;
if (!n) {
console.log("end")
}
})
但是“结束”从未打印过!我究竟做错了什么? 完整代码为here