Skip to content
New issue

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

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

Already on GitHub? # to your account

graph.fromJSON 接口是否可以支持diff部分更新 #4308

Open
wb-wenbei opened this issue May 16, 2024 · 1 comment
Open

graph.fromJSON 接口是否可以支持diff部分更新 #4308

wb-wenbei opened this issue May 16, 2024 · 1 comment

Comments

@wb-wenbei
Copy link

wb-wenbei commented May 16, 2024

功能描述

通过graph.formJson(json)更新图时,每次都是全量重绘,会导致画面闪烁。
示例
是否可以支持一个参数graph.fromJson(json, { diff: true })来更新变动的节点/边。

期望解决方案

调用fromJson(json)时,如果difftrue,则进行如下操作:

  1. 拿到现有graph中的cells列表。
  2. 首先通过cell.id对比出新增和删除的cell,将需要新增和删除的cell进行绘制。
  3. 如果有cell.id相同的cell,则通过diff算法查看cell属性是否变化,如变化,则直接更新cellprops
@louhaojie99
Copy link

使用 addNodes addEdges 等手段实现,不会有闪烁问题

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

No branches or pull requests

2 participants