antvis/G6





The issue has been closed
子图布局和配置布局结果不一致 #4657
mugo1993-ss posted onGitHub
问题描述
渲染前调用子图布局处理数据和直接配置layout图结果不一样
重现链接
https://stackblitz.com/edit/vue-wveeno?file=src%2FApp.vue
重现步骤
1.在图布局时。设置两种相同的布局
2.一种设置为子图布局,在graph.data(data)前调用
相关代码:
// 初始化布局,灌入子图数据 ---1.子图布局
const subgraphLayout = new G6.Layout['fruchterman']({
gravity: 5,
});
subgraphLayout.init({
nodes: data.nodes,
edges: data.edges,
});
subgraphLayout.execute();
this.graph?.data(data);
渲染结果:
3.一种直接配置layout
相关代码:
// ----2.配置布局
layout: {
type: 'fruchterman',
gravity: 5,
},
渲染结果:
预期行为
希望能看到相同的结果
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
- G6 版本: [4.5.1 ... ]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response