BarChart
Single-series vertical bar chart.
Basic usage
Data is passed in via props and rendered as plain SVG — no third-party charting library.
Colors come from the --viz-1..8 tokens and are color-blind friendly.
Demo source
<CfBarChart ... /> <CfBarChart ... /> Color
colorIndex 0..7 selects --viz-1..8 directly.
Demo source
<CfBarChart :data="data" :color-index="0" />
<CfBarChart :data="data" :color-index="3" /> <CfBarChart data={data} colorIndex={0} />
<CfBarChart data={data} colorIndex={3} /> Horizontal layout
Use orientation="horizontal" for rankings, comparisons, or longer category labels.
Demo source
<CfBarChart :data="data" :labels="labels" orientation="horizontal" /> <CfBarChart data={data} labels={labels} orientation="horizontal" /> API
| Prop | Type | Default | Description |
|---|---|---|---|
data | number[] | — | Bar heights |
labels | string[] | — | x-axis labels |
colorIndex | 0..7 | 0 | |
orientation | 'vertical' | 'horizontal' | 'vertical' | Bar direction |
width / height / showGrid / showLabels | “ | “ |
反馈与讨论
BarChart · Discussion