updateLayout(cfg)
- 如果参数 中含有
type
字段,type
字段类型为 String,且与现有布局方法不同,则更换布局; - 如果参数
cfg
中不包含type
字段,则保持原有布局,仅更新布局配置项。参数
const graph = new G6.Graph({
container: 'mountNode',
width: 1000,
height: 600,
default: ['drag-canvas', 'drag-node'],
},
layout: {
type: 'circular',
center: [500, 300],
},
animate: true,
});
graph.render();
// 实例化时通过layout指定布局,在合适的时候通过updateLayout更新布局配置
graph.updateLayout({
radius: 200,
startAngle: Math.PI / 4,
endAngle: Math.PI,
divisions: 5,
});