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 playgroundAbout
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
npm i @ashutoshswamy/smouiUsage
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.
More charts components
- AreaChartDraws itself in. A guide, dot and tooltip follow the pointer on springs.
- BarChartBars grow in a wave. The pointed bar lights up and its value pops above it.
- BulletChartProgress against a goal. The bar fills on a spring, a tick marks the target, and rows that beat it turn solid.
- BumpChartWho was ahead of whom, step by step. Lines swap places the way rankings do; point at one and it comes forward.
- ContributionGraphA calendar of days as squares, darker for busier ones. They pop in column by column; point at one for its date and count.
- DonutChartRing sweeps in segment by segment. Hover swells a segment and swaps the center.