# Bar Chart - Multiple

Use this template for a compact static-SVG grouped bar chart when two related series need
month-by-month magnitude comparison.

`widget-code.html` is a single `<svg>` root — no `<canvas>`, no Chart.js, no `<script>`. Neither
host can execute JavaScript, so every bar's value is a permanent on-chart label instead of a
hover tooltip.

## Use When

- Two related categories should be compared across the same ordered x-axis.
- The reader needs grouped magnitude comparison, not a continuous trend line.
- The visual can fit in one inline card with one focal point.
- The data has 3-12 groups and exactly two primary series.

## Avoid When

- The answer only needs one current number. Use a KPI summary pattern instead.
- The main story is a continuous trend. Use `line-trend` instead.
- The data needs ranking by category without time or ordered groups. Use a single horizontal
  bar pattern instead.
- More than two series are needed. Group, summarize, or use a table before rendering — do not
  add a third bar into this template's group slot.
- Stacked composition is the main story — `bar-stacked-legend` covers that, but it is currently
  `needs-static-rewrite`; use a fallback primitive until it's converted.

## Data Shape

Illustrative only — replace both the numbers and the coordinates in `widget-code.html` together
when adapting; there is no runtime data-binding layer.

```json
{
  "title": "Bar Chart - Multiple",
  "xDataKey": "month",
  "series": ["desktop", "mobile"],
  "chartData": [
    { "month": "January", "desktop": 186, "mobile": 80 },
    { "month": "February", "desktop": 305, "mobile": 200 }
  ]
}
```

## Visual Rules

- Keep exactly two series; use the high-contrast pair `--dui-chart-series-1` and
  `--dui-chart-series-2` so the bars stay distinguishable at small inline sizes.
- Do not use `--dui-accent` or semantic colors for ordinary peer sources such as channels,
  devices, models, teams, or regions.
- Include a compact legend (two labeled swatches) because color is the only thing distinguishing
  the two series.
- x-axis labels are abbreviated to three characters (Jan/Feb/Mar…).
- Horizontal grid lines only, drawn with `--dui-border`; the zero baseline uses
  `--dui-text-faint`.
- Hide y-axis tick labels — the per-bar value label already gives the reader the numbers.
- **Every bar's value is a permanent on-chart label above the bar**, not a hover tooltip.
- Leave enough headroom above the tallest bar's own label before the top grid line — pick the
  chart's max scale so the tallest bar tops out around 85% of the plot height, not 100%; otherwise
  its label collides with the top grid line (a real defect this file hit once while converting
  away from Chart.js — the value label sat directly on the grid line stroke).
- Do not add conclusion, recommendation, or analysis copy inside the widget.

## Edge Cases

- Missing/non-numeric values: omit that bar and its label, but keep the other series' bar and the
  x-axis label for that group.
- If every value is invalid, do not emit this chart — fall back to Markdown.
- If labels are long, abbreviate x-axis ticks.
- If more than two series are needed, do not force them into this template's fixed group-slot
  math — use a fallback primitive with a proper legend instead.

## Acceptance Checks

- `widget-code.html`'s only root element is `<svg>`; no `<canvas>`, no `<script>`.
- Every bar has a visible value label; no label overlaps a grid line, another label, or the
  neighboring bar in its group.
- `templates/manifest.json` marks `bar-chart-multiple` as `ready`.
