Javascript D3:设置饼图更新动画

Javascript D3:设置饼图更新动画,javascript,animation,d3.js,Javascript,Animation,D3.js,我正在尝试使用d3.js在饼图中设置更新动画。我尝试过使用attrTween函数,但似乎无法使其正常工作 function updatePieChart() { $.when(someOtherAjaxFunction()).done(function (json) { for (x in json) { var npath = d3.select('svg' + x).selectAll("path").data(pie(json))

我正在尝试使用d3.js在饼图中设置更新动画。我尝试过使用attrTween函数,但似乎无法使其正常工作

function updatePieChart() {
    $.when(someOtherAjaxFunction()).done(function (json) {
        for (x in json) {
            var npath = d3.select('svg' + x).selectAll("path").data(pie(json))
            npath.transition().duration(1000).attrTween("d", arcTween); // redraw the arcs
        }

        function arcTween(a) {
            var i = d3.interpolate(this._current, a);
            this._current = i(0);
            return function (t) {
                return arc(i(t));
            };
        }
    })

} //updatePieChart
非常感谢您的帮助


你看到了吗?是的,我看到了。似乎无法调整它。