Charts
BarChart
A grouped or stacked bar chart, following the same static/interactive split as LineChart — with per-bar hover instead of a continuous tooltip, since bars are discrete.
BarChartInteractiveBarChartPreview
Usage
tsx
import { InteractiveBarChart } from "@vesture/react";
const data = [
{ category: "Jan", revenue: 120, cost: 90 },
{ category: "Feb", revenue: 180, cost: 110 },
{ category: "Mar", revenue: 150, cost: 130 },
];
<div style={{ height: 320 }}>
<InteractiveBarChart
data={data}
series={[
{ key: "revenue", label: "Revenue" },
{ key: "cost", label: "Cost" },
]}
layout="stacked"
/>
</div>Behavior
- layout="grouped" (default) renders series as side-by-side bars per category; layout="stacked" stacks them cumulatively into one bar per category.
- BarChart is static and server-safe, same contract as LineChart: explicit width/height, no event handlers, no client JS.
- InteractiveBarChart auto-sizes to its parent and adds hover on individual bars (not a continuous overlay like LineChart) — each bar gets its own onMouseEnter/Leave, since bars are discrete rather than a continuous line.
- The legend toggle and series color-cycling/stability rules are identical to LineChart's.
Props
BarChartDataPoint
| Prop | Type | Default | Description |
|---|---|---|---|
| category | string | — | Required. The x-axis category for this row. |
| [seriesKey] | string | number | — | Each series' value, looked up by its key on this row. |
BarChartSeries
| Prop | Type | Default | Description |
|---|---|---|---|
| key / label | string | — | Required. Same as LineChartSeries. |
| color | string | — | Overrides the auto-assigned series1-8 token color for just this series. |
BarChart
| Prop | Type | Default | Description |
|---|---|---|---|
| data / series | required | — | Row data and series definitions, above. |
| width / height | number | — | Required. |
| layout | "grouped" | "stacked" | "grouped" | Side-by-side vs. cumulative stacking. |
| margin | { top, right, bottom, left } | { top: 16, right: 16, bottom: 32, left: 48 } | Chart margin, partially overridable. |
InteractiveBarChart
| Prop | Type | Default | Description |
|---|---|---|---|
| data / series / layout / margin | same as BarChart | — | |
| height | number | 320 | Fixed height — width auto-tracks the parent container. |