Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

element/index.js中syncShapeStyle方法在点击图例更新图表时出错 #3275

Closed
1 task
Break-2020 opened this issue Feb 7, 2021 · 7 comments
Closed
1 task

Comments

@Break-2020
Copy link

Break-2020 commented Feb 7, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://antv-g2.gitee.io/zh/examples/line/basic#curved

Steps to reproduce

syncShapeStyle这个方法在4.1.2里面存在一个问题,当sourceShape和targetShape都为group时,如果前面的shape数量多,在递归的时候newChildren[i]会是undefined,之后递归里面调用get('clipShape')会直接报错。

这个问题我看到你们后面有修复,是直接在前面加了一个 if (!sourceShape || !targetShape) return的判断。然后我更新到了最新的版本,但是还是会有问题。

我用到的是折线图,shape是自己注册的,在点击图例进行filter的时候,原本只隐藏一条数据的折线,但实际上两条折线都做着动画然后淡出消失了,第二次点图例的时候,g-base\lib\abstract\container.js就会报错,具体位置是Container.prototype.add里children.push(element),提示children是undefined。

这是正常render完以后
image

点击一个图例让其中一条折线消失(正在做动画,应该是你们预设的)
image

做完动画两条都消失了,我想应该是syncShapeStyle的问题
image

再次点击第一个图例时报错
image

Environment Info
g2 4.1.10
System -
Browser chrome
@Break-2020
Copy link
Author

我尝试用API文档里的方法,给chart先off后on去监听了legend:click或者是legend:mouseup,但是都不能覆盖掉原有的监听事件

@hustcc
Copy link
Member

hustcc commented Feb 8, 2021

@Break-2020 更新到最新的 4.1.x 版本试试看~之前有做过这部分的 issue。

@visiky
Copy link
Member

visiky commented Feb 9, 2021

4.1.4 版本之后还是有这个问题吗?

@Break-2020
Copy link
Author

4.1.4 版本之后还是有这个问题吗?

有,我用4.1.10试的

@visiky
Copy link
Member

visiky commented Feb 19, 2021

给一个稳定复现 demo?

@Break-2020
Copy link
Author

给一个稳定复现 demo?

暂时可能抽不出时间,后面抽空我搞一个

@Break-2020
Copy link
Author

Break-2020 commented Mar 12, 2021

给一个稳定复现 demo?

https://stackblitz.com/edit/react-xdoev8?file=src/index.js

这个链接应该可以用的吧,点击图例触发shape显示隐藏就会出问题
因为某些原因,我需要在注册shape的时候把line和point放在一个group里面,而不是用chart.line()和chart.point()的方式

问题应该是出在第一次点击,shape消失的这个过程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants