# Department by quarter (Trellis example)

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/gallery/trellis/trellis-department-by-quarter/ · Index for agents: https://westcoast-charts.com/llms.txt

Tidy rows (department, quarter, spend) become one column panel per department.

- Chart type: `bar` (Bar)
- Collection: Trellis · Trellis
- Raw configuration: https://westcoast-charts.com/gallery-src/trellis/trellis-department-by-quarter.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/trellis/department-by-quarter.html
- Same example as: https://westcoast-charts.com/gallery/trellis/department-by-quarter/index.md

## Setup

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

WestCoastCharts.use(types).use(trellis)
```

## Options

```js
const options = {
  chart: {
    height: "auto",
    fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
    type: "bar",
    toolbar: {
      show: false
    }
  },
  series: [],
  plotOptions: {
    bar: {
      borderRadius: 2,
      columnWidth: "55%"
    }
  },
  dataLabels: {
    enabled: false
  },
  trellis: {
    data: [
      {
        dept: "Platform",
        q: "Q1",
        spend: 37
      },
      {
        dept: "Platform",
        q: "Q2",
        spend: 54
      },
      {
        dept: "Platform",
        q: "Q3",
        spend: 62
      },
      {
        dept: "Platform",
        q: "Q4",
        spend: 77
      },
      {
        dept: "Payments",
        q: "Q1",
        spend: 67
      },
      {
        dept: "Payments",
        q: "Q2",
        spend: 46
      },
      {
        dept: "Payments",
        q: "Q3",
        spend: 70
      },
      {
        dept: "Payments",
        q: "Q4",
        spend: 42
      },
      {
        dept: "Search",
        q: "Q1",
        spend: 80
      },
      {
        dept: "Search",
        q: "Q2",
        spend: 71
      },
      {
        dept: "Search",
        q: "Q3",
        spend: 22
      },
      {
        dept: "Search",
        q: "Q4",
        spend: 62
      },
      {
        dept: "Mobile",
        q: "Q1",
        spend: 80
      },
      {
        dept: "Mobile",
        q: "Q2",
        spend: 59
      },
      {
        dept: "Mobile",
        q: "Q3",
        spend: 63
      },
      {
        dept: "Mobile",
        q: "Q4",
        spend: 27
      },
      {
        dept: "Data",
        q: "Q1",
        spend: 88
      },
      {
        dept: "Data",
        q: "Q2",
        spend: 90
      },
      {
        dept: "Data",
        q: "Q3",
        spend: 70
      },
      {
        dept: "Data",
        q: "Q4",
        spend: 71
      },
      {
        dept: "Growth",
        q: "Q1",
        spend: 49
      },
      {
        dept: "Growth",
        q: "Q2",
        spend: 34
      },
      {
        dept: "Growth",
        q: "Q3",
        spend: 67
      },
      {
        dept: "Growth",
        q: "Q4",
        spend: 36
      }
    ],
    by: "dept",
    x: "q",
    y: "spend",
    columns: 3,
    aspectRatio: 1.8,
    legend: "none"
  },
  title: {
    text: "Spend per quarter (k€)"
  },
  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 trellis-trellis-department-by-quarter.json --out trellis-trellis-department-by-quarter.svg --with-table` (save the options above as JSON first)
