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

[Bug]: Custom g2 node update exception drawing #6724

Open
3 of 10 tasks
zmoth opened this issue Jan 13, 2025 · 1 comment
Open
3 of 10 tasks

[Bug]: Custom g2 node update exception drawing #6724

zmoth opened this issue Jan 13, 2025 · 1 comment
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer

Comments

@zmoth
Copy link

zmoth commented Jan 13, 2025

Describe the bug / 问题描述

使用了两种方法去更新自定义节点。

  1. 使用updateData

使用此方法在连续两次给同一节点绘制时,edge路径异常、绘制的窗口也不会居中。

  1. 使用删除(removeData)再添加(addData)

使用这个方法在每次更新只会执行删除或者添加二选一,此外当有多个添加的数据时绘制的窗口也不会居中。

image

image

Reproduction link / 复现链接

https://codesandbox.io/p/sandbox/silly-snowflake-7dp2mc

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他
@zmoth zmoth added the status: waiting for maintainer These issues have not yet been reviewed by a maintainer label Jan 13, 2025
Copy link

您提到在使用 G6 5.x 版本时,遇到了自定义节点更新异常的问题。具体来说:

  1. 使用 updateData 方法时,连续两次绘制同一节点会导致边路径异常,并且绘制的窗口不会居中。
  2. 使用删除 (removeData) 再添加 (addData) 的方法时,每次更新只会执行删除或添加中的一个操作,并且当有多个添加的数据时,绘制的窗口也不会居中。

为了更好地帮助您解决这个问题,我建议您检查以下几点:

  • 确保在更新节点数据后,调用了 graph.refresh()graph.fitView() 来重新渲染图形并调整视图。
  • 检查自定义节点的 update 方法是否正确实现,确保在更新数据时,节点和边的状态都能正确反映。
  • 在使用 removeDataaddData 时,确保数据的唯一性和完整性,以避免不必要的重复操作。

如果这些建议没有解决您的问题,您可以提供更多的代码细节,或者在复现链接中详细描述如何触发问题,以便我能更好地帮助您。

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant