layout/indented/left-side
Example page
import { Graph, treeToGraphData } from '@antv/g6';
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => {
const graph = new Graph({
container: 'container',
data: treeToGraphData(data),
autoFit: 'view',
node: {
style: {
labelText: (d) => d.id,
labelPlacement: 'left',
labelBackground: true,
},
animation: {
enter: false,
},
},
edge: {
type: 'polyline',
style: {
radius: 4,
router: {
type: 'orth',
},
},
animation: {
enter: false,
},
},
layout: {
type: 'indented',
direction: 'RL',
indent: 80,
getHeight: () => 16,
getWidth: () => 32,
},
behaviors: ['drag-canvas', 'zoom-canvas', 'drag-element', 'collapse-expand'],
});
graph.render();
});