# ControlStrip (/docs/charts/control-strip)

ControlStrip answers "is the process in control — or did something leave the band?". It's a Shewhart individuals chart:
the control band is the process center ± 3σ̂, where **σ̂ = mean moving range ÷ 1.128** — the individuals estimator, stated
outright (sample SD is not used; it inflates the limits under drift). In-control points are bare vertices; only
out-of-control points are marked (ringed, in the negative color), because an in-control process should look boring.

```tsx
import { ControlStrip } from "@microcharts/react/control-strip";

// 30 fill-weight readings (g); mostly in control, two excursions const weights = [ 74, 73, 75, 74, 76, 73, 74, 75, 74,
73, 82, 74, 75, 73, 74, 76, 74, 73, 75, 74, 66, 74, 75, 74, 73, 76, 74, 75, 74, 73, ];

<ControlStrip data={weights} title="Line 3 fill weight" />
```

## Install

```tsx
import { ControlStrip } from "@microcharts/react/control-strip";

<ControlStrip data={weights} title="Line 3 fill weight" />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.


## When to use it

- **Good for** — a production line or metric in a table cell, an SPC control chart in a KPI card, flagging
  out-of-control excursions at a glance.
- **Avoid for** — a plain trend (Sparkline) or a strongly trending series (ChangePoint — control limits assume a
  stationary process).


## Variants

```tsx
const weights = [
  74, 73, 75, 74, 76, 73, 74, 75, 74, 73, 82, 74, 75, 73, 74, 76, 74, 73, 75, 74, 66, 74, 75, 74,
  73, 76, 74, 75, 74, 73,
];

<ControlStrip data={weights} rules="we" />
<ControlStrip data={weights} dots="all" />
```

```tsx
<ControlStrip
  data={[2.4, 2.5, 2.45, 2.55, 2.5, 2.6, 2.4, 2.5, 2.45, 2.9, 2.5, 2.55]}
  format={{ maximumFractionDigits: 1 }}
  locale="de-DE"
/>
```

The chart draws no in-chart numbers, so `format`/`locale` shape the accessible summary and the interactive announcements
— the strip above reads "All 12 points within control limits (center 2,5, limits 2,1–2,9)." with German decimal commas.

## Edge cases

```tsx
// the band gets a dashed outline and the summary appends
// "Limits provisional (n=6)"
<ControlStrip data={[10, 11, 9, 10, 12, 8]} />
```

```tsx
// MR̄ = 0 → σ̂ = 0: the band collapses into the center hairline
// instead of painting a fake zero-height zone
<ControlStrip data={[5, 5, 5, 5]} />
```


## Why this default

Flag only the out-of-band points, because an in-control process should look boring — the eye should land on the
exception, not scan every dot. The σ̂ estimator is the moving-range one (`MR̄ / 1.128`), never a vague "±3 sigma";
`limits="percentile"` states its exact quantiles for skewed processes. Western Electric rules are conventions, so the
implemented subset is enumerated (WE-1 beyond 3σ, WE-2 two-of-three beyond 2σ, WE-4 eight on one side) and none fires
silently. With fewer than 10 points the band is dashed and the summary says "limits provisional".

## Accessibility

The accessible name states the excursion count, the center, and the limits — **"2 of 30 points outside control limits
(center 74.17, limits 67.84–80.49)."**; an in-control run reads "All N points within control limits …". The interactive
entry steps the points and out-of-control points announce which limit they crossed.

The interactive entry follows the shared [interaction contract](/docs/accessibility#one-interaction-contract):
arrow keys rove between units on both axes, `Home` and `End` jump to the ends, and a click, tap, `Enter` or
`Space` selects a unit — pinning its readout so it survives blur, until you select it again or press `Escape`.
On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `number[]` | Sequential measurements. |
| `limits` | `"sigma" \| "percentile"` | ±3σ̂ (default) or empirical p0.135/p99.865 for skewed processes. |
| `baseline` | `number` | Known process center from a reference period (else = mean). |
| `rules` | `"none" \| "we"` | Western Electric secondary run rules (WE-1/2/4 subset). |
| `dots` | `"out" \| "all" \| "none"` | Mark only out-of-control points (default), every point, or none. |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
