Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 1.11 KB

File metadata and controls

40 lines (29 loc) · 1.11 KB
title Histogram
parent Display and data
grand_parent Components

Histogram

{: .no_toc }

A distribution, bucketed from raw values.

import { Histogram } from '@textui/widgets';

<Histogram values={[2, 3, 3, 4, 7, 8, 8, 9]} buckets={8} />

Props

Prop Type Default
values number[] required
buckets number 12 Number of buckets.
min number
max number
tone 'default' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'muted' 'accent'
chartHeight number 6

Plus everything on BoxProps.

Give it the raw values, not counts - the bucketing is the component's job, and doing it outside means two places decide what a bucket is.

buckets defaults to twelve. Fewer than the chart is wide wastes the space; more than that cannot be drawn.

See also

  • BarChart - when the categories are already decided
  • Heatmap - a distribution over two axes