HistogramChart

How a pile of numbers is spread out. Bars grow from the baseline; point at one for its range and count, with a line at the average. Charts.

Open playground
03060-31 ms63.5 ms158 ms252.5 ms347 msMean 123.4 ms

About

HistogramChart is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { HistogramChart } from "@ashutoshswamy/smoui" and set values, bins, showMean among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { HistogramChart } from "@ashutoshswamy/smoui";

<HistogramChart values={responseTimes} bins={14} suffix=" ms" unit="requests" />

Props 5

values

Raw values. They are binned for you.

number[]
bins

Default 12.

number
showMean

Draw the average line. Default true.

boolean
unit

What a count is, for the tooltip.

string
format / prefix / suffix

Number formatting.