我有一个饼图,其中创建了一个动画,使饼图弧在创建图表时按顺序增长。我也有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);
});