Skip to content

Components

Histogram

Request latency distribution

Use arrow keys to explore intervals, or Home and End to jump.

Component reference

Properties

Use Histogram

Show how often values such as request latency fall into equal-width intervals.

Example import style
histogram.tsxTSX
"use client";

import { FloodRoot, Histogram } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Histogram label="Request latency distribution" xLabel="Latency (ms)" countLabel="Requests" start={0} binWidth={50} counts={[5, 16, 34, 49, 41, 28, 17, 9, 4, 0]} />
    </FloodRoot>
  );
}

Design notes

  • Supply precomputed nonnegative integer counts in ascending bin order. Every bin shares binWidth. Keep interior zero bins so the numeric scale stays continuous.
  • Count each observation in exactly one interval. A typical convention includes the lower boundary and excludes the upper boundary, with the last upper boundary included if needed.
  • Compare histograms on the same numeric boundaries and maxCount. Set showXAxisLabel to false when the title already supplies the unit. Hover, tap or use the keyboard to inspect an interval and its exact count.

API reference

PropValuesDefault
labelstringRequired
xLabelstringRequired
showXAxisLabelboolean—
startnumberRequired
binWidthnumberRequired
countsreadonly number[]Required
maxCountnumber—
countLabelstring—
formatBoundary(value: number) => string—
formatCount(count: number) => string—
emptyLabelstring—
navigationLabelstring—
Native HTML propsOmit<HTMLAttributes<HTMLDivElement>, "children" | "role" | "aria-label">Forwarded
View TypeScript source