We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
参考帮助文档(https://g2.antv.vision/zh/examples/gallery/line#line8), 在写自己的一个多颜色段的line shape。发现如果数据更新时,往数据源里添加新的数据,效果就不对了,新添加的折线会空白显示。
以下是我的自己写shape
registerShape('line', 'split-line', { draw(cfg, container) { const path = []; const lines = buildLines() lines.map(line=>{ container.addShape('path',{ attrs:{ path: line.path, stroke: line.color, lineWidth: 2 } } }) return container; } });
看了下源代码,问题应该是在更新shape时,有关更新shape信息的相关代码syncShapeStyle没有和最新的shape同步。
syncShapeStyle
for (let i = 0; i < children.length; i++) { this.syncShapeStyle(children[i], newChildren[i], state, animateCfg, index + i); }
这里是根据原来shape的children在更新,如果newChildren里的数量大于原来children,那么最新的shape属性是更新不上去的。
The text was updated successfully, but these errors were encountered:
4.1.x 的最新版本,已经处理了这个情况,可以升级使用。
Sorry, something went wrong.
hustcc
No branches or pull requests
参考帮助文档(https://g2.antv.vision/zh/examples/gallery/line#line8), 在写自己的一个多颜色段的line shape。发现如果数据更新时,往数据源里添加新的数据,效果就不对了,新添加的折线会空白显示。
以下是我的自己写shape
看了下源代码,问题应该是在更新shape时,有关更新shape信息的相关代码
syncShapeStyle
没有和最新的shape同步。这里是根据原来shape的children在更新,如果newChildren里的数量大于原来children,那么最新的shape属性是更新不上去的。
The text was updated successfully, but these errors were encountered: