Skip to content

Histogram

How values spread: how many requests took 0–50 ms, 50–100 ms… The ranges are round and the bars touch, because the ranges do.

import { Histogram } from '@sypnia/ui/react'

On this page
  1. Response times
  2. When to use it
  3. For everyone
  4. Props

Response times

Response time
400 requests, last hour
01002003000 ms200 ms400 ms600 ms800 ms
View as table
TimeCount
0 ms – 100 ms160
100 ms – 200 ms209
200 ms – 300 ms0
300 ms – 400 ms0
400 ms – 500 ms3
500 ms – 600 ms6
600 ms – 700 ms6
700 ms – 800 ms6
800 ms – 900 ms8
900 ms – 1000 ms2
Code
import { Histogram } from '@sypnia/ui/react';

// How long 400 requests took. Most are fast; a tail is slow.
const values = Array.from({ length: 400 }, (_, i) => Math.round(40 + ((i * 37) % 97) + (i % 13 === 0 ? 400 + (i % 7) * 60 : 0) + (i % 5) * 9));
export default function Latency() {
  return <Histogram title="Response time" subtitle="400 requests, last hour" values={values} unit="Time" formatValue={(v) => `${v} ms`} />;
}

When to use it

Use it when

  • Times, sizes and other measures where the shape matters: most fast, a slow tail.

Do not use it when

  • Categories: use BarChart.

For everyone

  • Each bar is named with its range and count; the table lists every range.

Props

HistogramTypeDefault
titlerequired ReactNode
valuesrequired number[]
binCount number 12
empty ReactNode
error ReactNode
formatValue

How a value is written on the axis: «120 ms».

Fmt
height number
loading boolean
subtitle ReactNode
unit

The header of the first column of the table view.

string Range
  1. Response times
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms