Skip to content

Mixed strategies

Each container selects its own strategy and mode: a radial container of grids, with a linked tree inside one cell.

Edit it

Mixed strategiesPlayground →
Mixed strategies: the layouthubgrid-agrid-ba1a2a3a4treet1t1-1t1-2t2b1b2b3b4b5b6

18 boxes, 4 edges. The audit finds no defect.

The input

The same layout in TypeScript. The input is plain data, so it can come from JSON.

mixed.ts
import { layout } from "ireko";
const input = {
"root": {
"id": "hub",
"layout": "radial",
"mode": "nested",
"children": [
{
"id": "grid-a",
"mode": "nested",
"children": [
{
"id": "a1"
},
{
"id": "a2"
},
{
"id": "a3"
},
{
"id": "a4"
}
]
},
{
"id": "tree",
"children": [
{
"id": "t1",
"children": [
{
"id": "t1-1"
},
{
"id": "t1-2"
}
]
},
{
"id": "t2"
}
]
},
{
"id": "grid-b",
"mode": "nested",
"layout": {
"type": "grid",
"columns": 3
},
"children": [
{
"id": "b1"
},
{
"id": "b2"
},
{
"id": "b3"
},
{
"id": "b4"
},
{
"id": "b5"
},
{
"id": "b6"
}
]
}
]
}
};
const result = layout(input, {"nodeSize":{"width":64,"height":32},"spacing":14});