Histogram
A distribution of raw samples binned on nice edges, with p50 / p95 / p99 pinned onto the plot — the chart that shows the tail your average hides.
Latency with p50 / p95 / p99
@spectrumui/histogram-chart
API latency
900 samples · 22 bins
p50 29ms · p95 72ms · p99 109ms
| Range | Count | Share |
|---|---|---|
| 0ms – 10ms | 21 | 2.3% |
| 10ms – 20ms | 201 | 22.3% |
| 20ms – 30ms | 241 | 26.8% |
| 30ms – 40ms | 181 | 20.1% |
| 40ms – 50ms | 111 | 12.3% |
| 50ms – 60ms | 57 | 6.3% |
| 60ms – 70ms | 32 | 3.6% |
| 70ms – 80ms | 26 | 2.9% |
| 80ms – 90ms | 12 | 1.3% |
| 90ms – 100ms | 3 | 0.3% |
| 100ms – 110ms | 6 | 0.7% |
| 110ms – 120ms | 1 | 0.1% |
| 120ms – 130ms | 2 | 0.2% |
| 130ms – 140ms | 2 | 0.2% |
| 140ms – 150ms | 0 | 0.0% |
| 150ms – 160ms | 3 | 0.3% |
| 160ms – 170ms | 0 | 0.0% |
| 170ms – 180ms | 0 | 0.0% |
| 180ms – 190ms | 0 | 0.0% |
| 190ms – 200ms | 0 | 0.0% |
| 200ms – 210ms | 0 | 0.0% |
| 210ms – 220ms | 1 | 0.1% |
Login to view codeCreate a free account to access component source code
Login to view codeCreate a free account to access component source code
Login to view codeCreate a free account to access component source code
Order values
Order value
700 samples · 38 bins
p50 $57 · p95 $116
| Range | Count | Share |
|---|---|---|
| $10 – $15 | 1 | 0.1% |
| $15 – $20 | 7 | 1.0% |
| $20 – $25 | 12 | 1.7% |
| $25 – $30 | 28 | 4.0% |
| $30 – $35 | 49 | 7.0% |
| $35 – $40 | 58 | 8.3% |
| $40 – $45 | 69 | 9.9% |
| $45 – $50 | 51 | 7.3% |
| $50 – $55 | 61 | 8.7% |
| $55 – $60 | 45 | 6.4% |
| $60 – $65 | 39 | 5.6% |
| $65 – $70 | 39 | 5.6% |
| $70 – $75 | 37 | 5.3% |
| $75 – $80 | 27 | 3.9% |
| $80 – $85 | 34 | 4.9% |
| $85 – $90 | 25 | 3.6% |
| $90 – $95 | 23 | 3.3% |
| $95 – $100 | 20 | 2.9% |
| $100 – $105 | 18 | 2.6% |
| $105 – $110 | 11 | 1.6% |
| $110 – $115 | 8 | 1.1% |
| $115 – $120 | 8 | 1.1% |
| $120 – $125 | 7 | 1.0% |
| $125 – $130 | 2 | 0.3% |
| $130 – $135 | 4 | 0.6% |
| $135 – $140 | 0 | 0.0% |
| $140 – $145 | 7 | 1.0% |
| $145 – $150 | 2 | 0.3% |
| $150 – $155 | 2 | 0.3% |
| $155 – $160 | 0 | 0.0% |
| $160 – $165 | 2 | 0.3% |
| $165 – $170 | 1 | 0.1% |
| $170 – $175 | 0 | 0.0% |
| $175 – $180 | 0 | 0.0% |
| $180 – $185 | 1 | 0.1% |
| $185 – $190 | 0 | 0.0% |
| $190 – $195 | 1 | 0.1% |
| $195 – $200 | 1 | 0.1% |
Login to view codeCreate a free account to access component source code
Login to view codeCreate a free account to access component source code
Login to view codeCreate a free account to access component source code
Manual installation
Prefer to copy by hand? Open the Code tab on any example above and switch to the file you need — every source file is there, not just the demo. Drop them in your project like this:
chart-engine.tsxcomponents/spectrumui/charts/chart-engine.tsxhistogram-chart.tsxcomponents/spectrumui/charts/histogram-chart.tsx
There is nothing to install — this chart draws its own SVG and imports only @/lib/utils.
Usage
import { HistogramChart } from '@/components/spectrumui/charts/histogram-chart';
<HistogramChart data={samples} label="API latency" />- Pass raw samples — the chart bins them itself on human-readable edges.
buildBins()andpercentile()are exported if you need the numbers elsewhere.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | number[] | LATENCY_MS | Raw samples. The chart bins them itself. |
label | string | 'API latency' | Header title. |
format | (value: number) => string | - | Formats bin edges, percentile pins and the hover readout. |
percentiles | number[] | [50, 95, 99] | Which percentiles to pin onto the plot. |
bins | number | 26 | Target bin count. The real count lands on a nice step near it. |
height | number | - | Plot height in pixels. The header sits above it, so the card is taller than this. |
status | 'ready' | 'loading' | 'empty' | 'error' | 'ready' | Which state to render. All four reserve the same frame height, so nothing shifts when data lands. |
onRetry | () => void | - | Called by the retry button in the error state. Omit it and no button is shown. |
className | string | - | Merged onto the root element. |