d3 - mouseover和mouseout事件无法正常工作 [英] d3 - mouseover and mouseout event not working properly

查看:195
本文介绍了d3 - mouseover和mouseout事件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列使用d3创建的行。我写了一些 mouseover mouseout 事件事件。



当I mouseover 时,通过增加行的 y1 值可以正常工作。



但是在 mouseout 事件不能正常工作,我写代码设置回 y1 value的初始值。



FIDDLE



帮助我解决这个问题。

解决方案

使用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.

FIDDLE

Help me to fix this.

解决方案

When working with d3 transitions you need to be careful when nesting transitions or executing them simultaneously.

The solution

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆