layout is not a function
issue: github.com/antvis/X6/i…
文档未更新导致x6.antv.antgroup.com/examples/la… ,可以尝试下面的代码
import { Graph as GraphLib } from '@antv/graphlib';
import { GridLayout } from '@antv/layout';
const gridLayout = new GridLayout({
width: 1920,
height: 1080,
sortBy: 'label',
rows: 3,
cols: 7,
});
const cirGraph = new GraphLib({ nodes, edges });
gridLayout.execute(cirGraph).then((positions) => {
graphIns.current?.fromJSON(positions); // { nodes, edges }
});