D3听“结束”;转换事件

D3 listening to "end" event of a transition

本文关键字:转换 事件 结束 D3      更新时间:2023-09-26

我正在学习D3和以下这一课:https://www.youtube.com/watch?v=EpeOzq8eDYk&index=8&list=PL6il2r9i3BqH9PmbOf5wA5E1wOG3FT22p

为什么.each("end", function() {...}产生这个错误?Uncaught TypeError: callback.call is not a function

var canvas3 = d3.select("#doooo")
                .append("svg")
                .attr("width", 500)
                .attr("height", 500)
var circle3 = canvas3.append("circle")
                .attr("cx", 50)
                .attr("cy", 50)
                .attr("r", 25)
circle3.transition()
    .duration(1500)
    .attr("cx", 150)
    .each("end", function() { console.log("This is producing an error"); })

啊,.each("end", function() {...})(版本3)似乎在版本4中被.on("end", ...)取代了