# Live Data (Tree example)

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

Values update every 2 s; badges and totals follow, the view stays put.

- Chart type: `tree` (Tree)
- Collection: Tree · Tree
- Raw configuration: https://westcoast-charts.com/gallery-src/tree/live-data.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/premium/tree/live-data.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: 380,
    toolbar: {
      show: false
    },
    type: "tree"
  },
  series: [
    {
      data: [
        {
          name: "Live traffic",
          children: [
            {
              name: "Europe",
              children: [
                {
                  name: "Eu Web",
                  value: 32
                },
                {
                  name: "Eu App",
                  value: 98
                },
                {
                  name: "Eu API",
                  value: 119
                }
              ]
            },
            {
              name: "Americas",
              children: [
                {
                  name: "Am Web",
                  value: 60
                },
                {
                  name: "Am App",
                  value: 319
                },
                {
                  name: "Am API",
                  value: 320
                }
              ]
            },
            {
              name: "Asia",
              children: [
                {
                  name: "As Web",
                  value: 361
                },
                {
                  name: "As App",
                  value: 368
                },
                {
                  name: "As API",
                  value: 237
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  plotOptions: {
    tree: {
      node: {
        template: "compact"
      }
    }
  },
  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-live-data.json --out tree-live-data.svg --with-table` (save the options above as JSON first)
