ComboChart

Combine lines, bars, and areas in a single chart with optional dual Y-axes. Perfect for showing correlated metrics with different scales.

Playground

Experiment with different settings:

Props

Midnight
0.6
2
OffOn
Code
<ComboChart
  data={data}
  theme="midnight"
  barRatio={0.6}
  strokeWidth={2}
  showGrid
/>

Bar + Line (Dual Axis)

The classic combo chart: bars for absolute values, line for rates/percentages:

Revenue
Growth %
$0K$36K$72K$107K$143KRevenue ($)0%7%14%21%28%Growth (%)JanFebMarAprMayJunJulAug
tsx
<ComboChart
  data={data}
  series={[
    { key: 'revenue', label: 'Revenue', type: 'bar', yAxis: 'left' },
    { key: 'growth', label: 'Growth %', type: 'line', yAxis: 'right' },
  ]}
  categoryKey="month"
  theme="midnight"
  yLabelLeft="Revenue ($)"
  yLabelRight="Growth (%)"
  formatYLeft={(v) => `$${(v / 1000).toFixed(0)}K`}
  formatYRight={(v) => `${v.toFixed(0)}%`}
/>

Multiple Bars + Line

Compare multiple bar series with a trend line:

Revenue
Expenses
Growth %
$0K$36K$72K$107K$143K0%7%14%21%28%JanFebMarAprMayJunJulAug

Area + Line

Use area for volume and line for rates:

Revenue
Growth %
$0K$36K$72K$107K$143K0%7%14%21%28%JanFebMarAprMayJunJulAug

Series Configuration

Each series is configured with a ComboSeriesConfig object:

PropTypeDefaultDescription
key*string-Data key for this series
label*string-Display label
type*"line" | "bar" | "area"-Series type
yAxis"left" | "right""left"Which Y-axis to use
colorstring-Custom color (overrides theme)

Props

PropTypeDefaultDescription
data*T[]-Data array
series*ComboSeriesConfig[]-Series configuration
categoryKey*keyof T-Key for X-axis categories
widthnumber600Chart width
heightnumber400Chart height
theme*ThemeName-Theme name
yLabelLeftstring-Left Y-axis label
yLabelRightstring-Right Y-axis label
xLabelstring-X-axis label
formatYLeft(value: number) => string-Left Y-axis formatter
formatYRight(value: number) => string-Right Y-axis formatter
barRationumber0.6Bar width ratio (0-1)
strokeWidthnumber2Line stroke width
fillOpacitynumber0.3Area fill opacity
showGridbooleantrueShow grid lines
onDataPointClick(event: DataPointClickEvent) => void-Click handler
renderTooltip(props: TooltipRenderProps) => ReactNode-Custom tooltip
annotationsAnnotation[]-Reference lines and areas