antvis/G6

layout为radial时,通过addItem添加节点不符合radial布局 #5281

zhang759740844 posted onGitHub

G6 Version

4.x

Describe the bug

业务诉求是:通过 radial 布局展示数据,并且希望双击加载更多数据。

我的做法:

  1. 尝试通过 addItem 添加 node 和 edge,但是添加之后因为 node 没有 x,y所以渲染在默认的位置上。不符合 radial 布局
  2. 尝试通过 render 或者 updateLayout 重绘,node 和 edge 布局变化,没有再原来位置
  3. 尝试将第一次渲染的node的 x,y保存起来,下次重绘时设置上去,实际测试无效果,被 radial 布局覆盖了

Your Example Website or App

https://codesandbox.io/p/sandbox/g6-radialbu-ju-tian-jia-zi-yuan-su-k7njnv?file=%2Findex.html%3A142%2C27

Steps to Reproduce the Bug or Issue

  1. 双击 “node_23456 双击此节点添加节点” 节点,新增节点在默认位置,不符合 radial 布局

Expected behavior

添加的新节点也符合 radial 布局

Screenshots or Videos

https://img.alicdn.com/imgextra/i4/O1CN01h68ctP1TGBFVgr3Ln_!!6000000002354-0-tps-508-458.jpg

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 119.0.6045.199

Additional context

No response


hi @zhang759740844, welcome!

posted by github-actions[bot] over 1 year ago

Hi @zhang759740844, Please star this repo if you find it useful! Thanks :star:! 你好 @zhang759740844。如果该仓库对你有用,可以 star 一下,感谢你的 :star:!

posted by github-actions[bot] over 1 year ago

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] 10 months ago

Fund this Issue

$0.00
Funded

Pull requests