d3 - mouseover和mouseout事件无法正常工作 [英] d3 - mouseover and mouseout event not working properly
问题描述
我有一系列使用d3创建的行。我写了一些 mouseover
和 mouseout
事件事件。
当I mouseover
时,通过增加行的 y1
值可以正常工作。
但是在 mouseout
事件不能正常工作,我写代码设置回 y1
value的初始值。
帮助我解决这个问题。
使用d3转换时,您需要在嵌套转换或同时执行转换时小心。
我刚刚更改了 moveout
方法更新所有行的 stroke
和 y1
。并且,在扩展当前翻转线之前, movein
方法重置所有线的 y1
>
I have a series of line that's created using d3. And i've written some mouseover
and mouseout
event events.
When I mouseover
the event works properly by increasing the y1
value of the line.
But on mouseout
the event doesn't works properly where i've written code set back the y1
value to the initial value.
Help me to fix this.
When working with d3 transitions you need to be careful when nesting transitions or executing them simultaneously.
I just changed the moveout
method to update the stroke
and y1
of all lines irrespective of which line triggered the function. And, the movein
method to reset the y1
of all lines before extending the currently rolled-over line.
这篇关于d3 - mouseover和mouseout事件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!