Vesture

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.

BarChartInteractiveBarChart

Preview

JanFebMarAprMayJun020406080100120140160180200220240260

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

PropTypeDefaultDescription
categorystringRequired. The x-axis category for this row.
[seriesKey]string | numberEach series' value, looked up by its key on this row.

BarChartSeries

PropTypeDefaultDescription
key / labelstringRequired. Same as LineChartSeries.
colorstringOverrides the auto-assigned series1-8 token color for just this series.

BarChart

PropTypeDefaultDescription
data / seriesrequiredRow data and series definitions, above.
width / heightnumberRequired.
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

PropTypeDefaultDescription
data / series / layout / marginsame as BarChart
heightnumber320Fixed height — width auto-tracks the parent container.