Charts

Line Chart

Line and area variants. Multi-series with hover tooltips and animated mount. Built with D3 scales and Catmull-Rom smooth curves.

$0$20K$40K$60K$80KJanFebMarAprMayJunJulAug
Revenue

Usage

import { LineChart, formatCurrency } from 'foundry-charts'

<LineChart
  data={[
    { month: 'Jan', revenue: 42000 },
    { month: 'Feb', revenue: 55000 },
    // ...
  ]}
  series={[{ key: 'revenue', label: 'Revenue' }]}
  xKey="month"
  variant="line"
  formatY={formatCurrency}
/>

Props

PropTypeDefaultDescription
dataLineChartDatum[]Array of data objects. Each object represents one x-axis point.
seriesSeriesConfig[]Which keys to plot. Each entry has key, label, and optional color.
xKeystringThe key in each datum that provides the x-axis label.
variant'line' | 'area''line'Line only, or line with gradient fill below it.
curve'smooth' | 'linear''smooth'Catmull-Rom smooth curves or straight line segments.
heightnumber320Chart height in pixels. Width is always 100% of the container.
formatY(v: number) => stringformatValueFormatter for y-axis ticks and tooltip values.
formatX(v: string) => stringOptional formatter for x-axis tick labels.
classNamestringAdditional CSS class on the root element.
styleCSSPropertiesInline styles on the root element.