Vesture

Charts

AreaChart

A filled-region chart reusing LineChart's scale, axis, and hover-tooltip logic almost entirely — the same static/interactive split, plus overlapping or stacked fills.

AreaChartInteractiveAreaChart

Preview

JanFebMarAprMayJun020406080100120140160180200220240260

Usage

tsx
import { InteractiveAreaChart } from "@vesture/react";

const data = [
  { x: "Jan", revenue: 120, cost: 90 },
  { x: "Feb", revenue: 180, cost: 110 },
  { x: "Mar", revenue: 150, cost: 130 },
];

<div style={{ height: 320 }}>
  <InteractiveAreaChart
    data={data}
    series={[
      { key: "revenue", label: "Revenue" },
      { key: "cost", label: "Cost" },
    ]}
    stacked
  />
</div>

Behavior

  • stacked={false} (default) overlaps each series' fill at partial opacity so every series stays visible where they intersect; stacked renders cumulative filled regions instead, like a stacked bar chart smoothed into areas.
  • Data/series shape, x-scale inference, margin defaults, and series color cycling are identical to LineChart's — AreaChartDataPoint and AreaChartSeries are literally the same types.
  • InteractiveAreaChart uses the same continuous nearest-point hover technique as InteractiveLineChart (not BarChart's discrete per-bar hover) — an area chart behaves like a line chart for hover purposes.

Props

AreaChart

PropTypeDefaultDescription
data / seriesAreaChartDataPoint[] / AreaChartSeries[]Identical shape to LineChartDataPoint / LineChartSeries.
width / heightnumberRequired.
stackedbooleanfalsefalse = overlapping fills at partial opacity; true = cumulative stacked fills.
xScale"linear" | "time" | "band"Same inference rule as LineChart.
margin{ top, right, bottom, left }{ top: 16, right: 16, bottom: 32, left: 48 }Chart margin, partially overridable.

InteractiveAreaChart

PropTypeDefaultDescription
data / series / xScale / stacked / marginsame as AreaChart
heightnumber320Fixed height — width auto-tracks the parent container.