antvis/G6

Do you want to work on this issue?

You can request for a bounty in order to promote it!

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

zmoth posted onGitHub

Describe the bug / 问题描述

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

  1. 使用updateData

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

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

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

image

image

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 / 其他

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

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

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

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

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

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

posted by petercat-assistant[bot] 3 months ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests