# Node Wrappers (Tree example)

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/gallery/tree/node-wrappers/ · Index for agents: https://westcoast-charts.com/llms.txt

Labelled frames around departments (data wrapper: { label, color } or plotOptions.tree.wrappers: [{ id, label }]); frames nest (Platform inside Engineering), push neighbours apart and follow expand / collapse.

- Chart type: `tree` (Tree)
- Collection: Tree · Tree
- Raw configuration: https://westcoast-charts.com/gallery-src/tree/node-wrappers.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/premium/tree/node-wrappers.html

## Setup

```js
import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'
import premium from 'west-coast-charts/premium'

WestCoastCharts.use(types).use(premium)
const WestCoastChartsPremium = premium
WestCoastCharts.setLicenseKey(LICENCE_KEY) // paid production licence; localhost evaluation needs no key
```

## Options

```js
const options = {
  chart: {
    height: 900,
    toolbar: {
      show: false
    },
    type: "tree"
  },
  series: [
    {
      data: [
        {
          id: "p26",
          name: "Kira Lund",
          title: "Chief Executive",
          children: [
            {
              id: "p9",
              name: "Maya Grieve",
              title: "VP Engineering",
              children: [
                {
                  id: "p4",
                  name: "Yara Quist",
                  title: "Platform lead",
                  children: [
                    {
                      id: "p1",
                      name: "Ava Holm",
                      title: "Site reliability",
                      children: undefined
                    },
                    {
                      id: "p2",
                      name: "Zane Quist",
                      title: "Infrastructure",
                      children: undefined
                    },
                    {
                      id: "p3",
                      name: "Vik Thorne",
                      title: "Developer tools",
                      children: undefined
                    }
                  ],
                  wrapper: {
                    label: "Platform",
                    dashed: true
                  }
                },
                {
                  id: "p8",
                  name: "Elif Oakes",
                  title: "Product engineering",
                  children: [
                    {
                      id: "p5",
                      name: "Vik Grieve",
                      title: "Web",
                      children: undefined
                    },
                    {
                      id: "p6",
                      name: "Sana Faro",
                      title: "Mobile",
                      children: undefined
                    },
                    {
                      id: "p7",
                      name: "Ben Ivers",
                      title: "API",
                      children: undefined
                    }
                  ]
                }
              ],
              wrapper: {
                label: "Engineering"
              }
            },
            {
              id: "p15",
              name: "Ben Oakes",
              title: "VP Product",
              children: [
                {
                  id: "p12",
                  name: "Dev Castell",
                  title: "Design lead",
                  children: [
                    {
                      id: "p10",
                      name: "Sana Oakes",
                      title: "Research",
                      children: undefined
                    },
                    {
                      id: "p11",
                      name: "Cleo Dorsey",
                      title: "Visual design",
                      children: undefined
                    }
                  ]
                },
                {
                  id: "p13",
                  name: "Rafa Marlow",
                  title: "PM, Billing",
                  children: undefined
                },
                {
                  id: "p14",
                  name: "Tomas Quist",
                  title: "PM, Growth",
                  children: undefined
                }
              ]
            },
            {
              id: "p22",
              name: "Pia Rook",
              title: "VP Sales",
              children: [
                {
                  id: "p18",
                  name: "Elif Jarl",
                  title: "EMEA",
                  children: [
                    {
                      id: "p16",
                      name: "Iris Faro",
                      title: "Account exec.",
                      children: undefined
                    },
                    {
                      id: "p17",
                      name: "Tomas Sorel",
                      title: "Account exec.",
                      children: undefined
                    }
                  ]
                },
                {
                  id: "p20",
                  name: "Pia Thorne",
                  title: "Americas",
                  children: [
                    {
                      id: "p19",
                      name: "Yara Arden",
                      title: "Account exec.",
                      children: undefined
                    }
                  ]
                },
                {
                  id: "p21",
                  name: "Dev Faro",
                  title: "APAC",
                  children: undefined
                }
              ],
              wrapper: {
                label: "Sales"
              }
            },
            {
              id: "p25",
              name: "Elif Rook",
              title: "CFO",
              children: [
                {
                  id: "p23",
                  name: "Rafa Thorne",
                  title: "Controller",
                  children: undefined
                },
                {
                  id: "p24",
                  name: "Wren Faro",
                  title: "FP&A",
                  children: undefined
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  plotOptions: {
    tree: {
      colorBy: "branch",
      node: {
        width: 180
      },
      wrappers: [
        {
          id: "p25",
          label: "Finance"
        }
      ]
    }
  },
  theme: {
    mode: "light",
    preset: "coastal"
  }
}

const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render()
```

## Verify

- Text check (Library 1.1.5): load `west-coast-charts/agent/describe` and call `chart.describe({ format: "json" })` for the actual drawn state. The live reader is on this example’s HTML page.
- Command line (Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm, https://westcoast-charts.com/docs/cli/index.md): `wcc chart export tree-node-wrappers.json --out tree-node-wrappers.svg --with-table` (save the options above as JSON first)
