antvis/G6

如何获取图中每一个节点的position? #4538

fromageage posted onGitHub

问题描述

在使用不同的布局方法对图进行布局时,通过graph.save()获取图数据,怎么才能拿到布局后每一个节点的Postion呢?

重现链接

https://g6.antv.antgroup.com/api/graph-func/data

重现步骤

graph.save() 只能获取到基本数据,希望能有节点的posion:{X,Y} ,每个节点对应画布的X,Y坐标

预期行为

获取数据后,包含节点的posion:{X,Y} ,每个节点对应画布的X,Y坐标

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


这个方法能够满足你 const nodes = graph.getNodes(); https://g6.antv.antgroup.com/api/graph-func/find

posted by PmcFizz almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests