Components
Distribution
Shows where the middle (p50 to p75) and the tail (p75 to p90) of a distribution sit, one row per series on a shared scale.
Overview
Distribution draws one row per series on a shared horizontal scale: a solid bar from p50 to p75, a lighter bar from p75 to p90, and a marker at each percentile. Hovering or focusing a row shows its values in a tooltip. It suits durations and other skewed measures, where an average hides the tail.
A null percentile means "no data", never zero. A row with no data shows a "No data" note, and when no row has any data the chart renders an empty state.
Import
import { Distribution } from '@unflowio/ui/components/Distribution';Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Required. Accessible name of the chart, also the caption of the hidden data table |
rows | DistributionRow[] | — | Required. One row per series |
domain | [number, number] | [0, largest value] | Shared scale for every row. Values outside it are clamped to its edge and flagged in the hidden table |
formatValue | (value: number) => string | Intl.NumberFormat | Formats values in ticks, tooltips and the hidden table |
ticks | number | 4 | Number of axis labels, including both ends |
emptyState | ReactNode | StateMessage | Rendered when no row has any data |
DistributionRow:
| Field | Type | Description |
|---|---|---|
label | string | Required. Series name |
p50 / p75 / p90 | number | null | Required. Percentiles. null means no data |
Basic usage
| Series | p50 | p75 | p90 |
|---|---|---|---|
| Time to first review | 3.5 h | 7 h | 19 h |
| Review to merge | 2 h | 4 h | 9.5 h |
| Merge to deploy | 0.5 h | 1 h | 2.5 h |
<Distribution label="Cycle time, last 90 days" rows={cycleTime} formatValue={(value) => `${value} h`} />Missing data
| Series | p50 | p75 | p90 |
|---|---|---|---|
| Time to first review | 3.5 h | 7 h | 19 h |
| Review to merge | 2 h | 4 h | 9.5 h |
| Merge to deploy | 0.5 h | No data | 2.5 h |
| Hotfix to deploy | No data | No data | No data |
Custom domain
Pass domain to compare charts on the same scale, or to cap a long tail.
| Series | p50 | p75 | p90 |
|---|---|---|---|
| Time to first review | 3.5 h | 7 h | 19 h, outside the scale |
| Review to merge | 2 h | 4 h | 9.5 h |
| Merge to deploy | 0.5 h | 1 h | 2.5 h |
<Distribution label="Cycle time, capped at 12 hours" rows={cycleTime} domain={[0, 12]} ticks={5} />Empty state
No data yet
Accessibility
- The chart is a
role="figure"named bylabel. Each row's bar is arole="img"with a summary such as "Review to merge: p50 2 h, p75 4 h, p90 9.5 h". - A visually hidden table with the same numbers, captioned by
label, lists every row, including rows with no data and values outside the scale.