UnflowUI
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

PropTypeDefaultDescription
labelstring—Required. Accessible name of the chart, also the caption of the hidden data table
rowsDistributionRow[]—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) => stringIntl.NumberFormatFormats values in ticks, tooltips and the hidden table
ticksnumber4Number of axis labels, including both ends
emptyStateReactNodeStateMessageRendered when no row has any data

DistributionRow:

FieldTypeDescription
labelstringRequired. Series name
p50 / p75 / p90number | nullRequired. Percentiles. null means no data

Basic usage

Cycle time, last 90 days
Seriesp50p75p90
Time to first review3.5 h7 h19 h
Review to merge2 h4 h9.5 h
Merge to deploy0.5 h1 h2.5 h
<Distribution label="Cycle time, last 90 days" rows={cycleTime} formatValue={(value) => `${value} h`} />

Missing data

Cycle time, last 90 days
Seriesp50p75p90
Time to first review3.5 h7 h19 h
Review to merge2 h4 h9.5 h
Merge to deploy0.5 hNo data2.5 h
Hotfix to deployNo dataNo dataNo data

Custom domain

Pass domain to compare charts on the same scale, or to cap a long tail.

Cycle time, capped at 12 hours
Seriesp50p75p90
Time to first review3.5 h7 h19 h, outside the scale
Review to merge2 h4 h9.5 h
Merge to deploy0.5 h1 h2.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 by label. Each row's bar is a role="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.