Preview Updated 2026-05-10

Histogram

Binned histogram with one bar per bin.

Basic usage

Data is passed in via props. Pure SVG rendering, no third-party chart library dependency. Colors come from the --viz-1..8 tokens and are colorblind-friendly.

0-5050-100100-200200-500500-1k1k-2k2k-5k5k+
Demo source
src/App.vue vue
<CfHistogram ... />
src/App.tsx tsx
<CfHistogram ... />

Two typical distributions

Normal vs. long-tail distribution — for long-tailed data, consider log-scale bin labels.

正态分布
40-6060-8080-100100-120120-140140-160160-180
长尾分布
0-100100-200200-400400-800800-1.6k1.6k+
Demo source
src/App.vue vue
<CfHistogram :bins="bins" />
src/App.tsx tsx
<CfHistogram bins={bins} />

API

PropTypeDefaultDescription
binsHistogramBin[]{ label, count }[]
colorIndex0..70
showLabelsbooleantrueShow/hide bin labels

反馈与讨论

Histogram · Discussion

0
0 / 600
一键发送
正在加载评论...