# Daily bars

A value per day as stacked bars: a legend that hides series, dates that thin before they collide and the day's reading.

Live variants: https://design.arcadia.is/components/daily-bars

```tsx
import { DailyBars, providerChartColor, fmtTokens } from "@arcadia/ui";
```

Compare daily token use by provider. Select a provider to hide or show it.

```tsx
import { DailyBars, providerChartColor } from "@arcadia/ui";

<DailyBars label="Tokens per day" days={DAYS} series={[
  { key: "antigravity", label: "Google", values: wave(3, 48_000_000), color: providerChartColor("antigravity") },
  { key: "chatgpt", label: "ChatGPT", values: wave(2, 21_000_000), color: providerChartColor("chatgpt") },
  { key: "zai", label: "Z.ai", values: wave(5, 9_000_000), color: providerChartColor("zai") },
]} />
```

## Accessibility

The plot is a focusable slider named by `label` with each series' total. Left and Right step through the days, Home and End jump to the ends, and Escape clears the reading. The slider announces the date and values for the day in focus. The legend's chips are toggle buttons with their pressed state. Under forced colours the bars and the swatches keep their series' colours. On touch a swipe up or down that starts on the bars scrolls the page; a tap or a sideways drag reads.

## API reference

### DailyBars

- `days` (`readonly string[]`, required)
- `series` (`readonly DailyBarsSeries[]`, required)
- `label` (`string`, required)
- `format` (`(n: number) => string`)
- `legend` (`boolean`)
- `highlight` (`string | null`, default `null`)
- `size` (`"md" | "sm"`, default `"md"`)
- `rootStyle` (`DailyBarsStyle`)

Rest props go to `HTMLAttributes<HTMLDivElement>`.
