D3在同一个svg元素上进行了多次转换,从而限制了上一个转换完成?

我有一个饼图,其中创建了一个动画,使饼图弧在创建图表时按顺序增长。我也有mouseover事件,如果将鼠标悬停,它将扩展弧线。现在的问题是,如果在图表创建过程中将鼠标悬停,mouseover事件将限制过渡。我做了很多研究,但似乎对我没有任何帮助。有人可以帮我吗?

这是代码段

var path = svg .append('g')
    .attr('transform',`translate(${width / 2},${(height / 2) -30})`)
    .selectAll('path')
    .data(pie(dataset))
    .enter()
    .append('path')
    .attr('fill',function (d,i) {
        return color(d.data.name);
    })
    .attr('id',function (d) {
        return "item"+d.data.name.replace(regex,'') + chartIndex + d.data.id;
    })
    .style('cursor','pointer')
    .each(function (d) {
        this._current = d;
    })

    path.transition('create')
        .duration(function(d,i) {
            return i * 200;
        })
        .attrTween('d',function(d) {
            var i = d3.interpolate(d.startAngle+0.1,d.endAngle);
            return function(t) {
                d.endAngle = i(t);
                return arc(d);
            }
        })
path.on('mouseover',function (d) {
    d3.select("#tooltip"+chartIndex)
    .style("display","inline")
    d3.select(this).transition('expand')
    .attr("d",arcOver);
});
kingjohy 回答:D3在同一个svg元素上进行了多次转换,从而限制了上一个转换完成?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3031338.html

大家都在问