G2
G2 copied to clipboard
TypeError: Cannot create property 'lineStyle' on boolean 'false'
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://stackblitz.com/edit/vitejs-vite-qdhzkz?file=main.js,index.html
Steps to reproduce
打开浏览器控制台即可看到报错。

Environment | Info |
---|---|
g2 | 3.5.19 |
System | OS: macOS 12.4 |
Browser | Chrome: 103.0.5060.134 |
在Vite中使用@antv/g2,折线图的tooltip无法正常加载,并且浏览器控制台报错。
已经定位到问题:tooltip.crosshairs的初始值为false,会执行g2内部的_mix方法,在严格模式下会抛出错误。

希望能尽快解决这一问题。
@xbzhang2020 已经定位到问题了,有兴趣来提交 pr 吗?另外,可以尽快调研迁移到新版本了。
好的,我提个PR。
请问这个bug是在哪个版本里面修复的呢?
好的,我提个PR。
麻烦问题是哪个PR修复的呀?
好的,我提个PR。
屁事不干,到现在还有这个问题
这个问题到现在还存在,尝试切换成 canvas 渲染模式,发现 canvas 模式比 html 模式效果差很多。目前没找到办法可以规避
这个问题不好修复,真正出错的地方应该在g2的一个依赖的@antv/util包中,就搁置了。如果遇到同类问题,可以使用 patch-package 工具给这个包打个补丁,自己就是这么解决的。期待有能力的大佬修复这个问题吧。