Hierarchical Layout
Configure hierarchical layout by setting type: "hierarchical" in the enableLayout method of a CanvasBuilder instance.
const element = document.getElementById("canvas");
const canvas = new CanvasBuilder(element)
.enableLayout({
algorithm: {
type: "hierarchical",
},
})
.build();
Hierarchical layout supports optional configuration parameters:
const canvas = new CanvasBuilder(element)
.enableLayout({
algorithm: {
type: "hierarchical",
layerWidth: 300,
layerSpace: 300,
},
})
.build();
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
layerWidth | number | Width of a single layer | No | 300 |
layerSpace | number | Minimum space between nodes within a single layer | No | 300 |