本文档是关系图库 —— G6.Layouts 布局包文档, 您能从该文档中快速查找到其内置的所有布局。如果有你觉得描述的不够清晰的地方敬请联系我们!
树布局
为了方便大家使用,G6 官方自研并内置了以下几种树布局算法:
使用方式
只需要在外部实例化一个布局对象,并传入图类即可。
const layout = new G6.Layouts.CompactBoxTree(options);const data = {roots: [{label: 'root',children: [{label: 'child1',children: [{label: 'child\n1.1'}]}, {label: 'child2'}]}]};const tree = new G6.Tree({container: 'mountNode',width: 500,height: 500,layout,fitView: 'cc'});tree.read(data);
