antvis/G6

我用了其他图可视化库渲染相同的数据,挺美观,如何使用G6的force布局达到这种效果,所有布局都试了下,还是不太理想 #4961

QuietlyChan posted onGitHub

问题描述

我用了其他图可视化库渲染相同的数据,挺美观,如何使用G6的force布局达到这种效果,所有布局都试了下,还是不太理想 <img width="834" alt="image" src="https://github.com/antvis/G6/assets/8343216/773db41f-71af-42d2-a974-e50622684428"> <img width="1023" alt="image" src="https://github.com/antvis/G6/assets/8343216/7a51e0be-548a-4ce0-9a02-54c03fd0efdb">

重现链接

https://cdn.puritychan.cn/graph/demo/index.html

重现步骤

<img width="544" alt="image" src="https://github.com/antvis/G6/assets/8343216/462cadae-808e-45d9-a9e5-b6142b874729"> 这两个库的两个效果

预期行为

希望g6的force布局可以达到一个比较美观的程度

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


首先 relationGraph 看起来不是用力导向,应该对应 G6 的是 radial 布局:https://g6.antv.antgroup.com/examples/net/radialLayout/#sortRadial

另外力导结果不是很理想,应该是参数问题,linkDistance 调小一些试试,参数列表:https://g6.antv.antgroup.com/api/graph-layout/force

force2 也可以试试:https://g6.antv.antgroup.com/api/graph-layout/force2

posted by Yanyan-Wang over 1 year ago

谢谢,用了force2的 preset: { type: 'radial' }, 效果还可以

posted by QuietlyChan over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests