Skip to content
misoto22 design

Charts

ComposedChart

Bars and lines over one axis — the volume, and the rate it moved at.

When to reach for it

Two measures that share a scale. Two that do NOT share one belong in two charts or indexed to a common base: there is no second y-axis here, on purpose.

Examples

default

Revenue and profit
Revenue and profit
monthRevenueProfit
Jan4,2001,800
Feb5,8002,400
Mar4,1001,600
Apr6,2002,800
May5,4002,200
Jun7,8003,400

variants

Revenue and profit
Revenue and profit
RevenueProfit
4,2001,800
5,8002,400
4,1001,600
6,2002,800
5,4002,200
7,8003,400

hover highlight

Revenue and profit
Revenue and profit
RevenueProfit
4,2001,800
5,8002,400
4,1001,600
6,2002,800
5,4002,200
7,8003,400

brush and loading

Revenue and profit
Revenue and profit
dayRevenueProfit
D13,2002,700
D24,3782,644
D35,4262,480
D46,2292,217
D56,6991,873
D66,7831,468
D76,4731,027
D85,8031,221
D94,8461,649
D103,7082,031
D113,8862,342
D125,0052,564
D135,9242,682
D146,5442,689
D156,7962,586
D166,6522,377
D176,1282,077
D185,2821,703
D194,2061,279
D203,380968
D214,5471,411
D225,5651,822
D236,3232,176
D246,7372,450
D256,7622,628
D266,3942,699
D275,6752,658
D284,6842,507
D293,5292,257
D304,0621,922
Loading
Loading

Notes

Bars and lines over one axis — the shape for "the volume, and the rate it moved at".

One axis, always. Two measures at different scales belong in two charts or indexed to a common base; a second y-scale lets the author choose where the lines cross, which is the single most misleading thing a chart can do.

Props

ComposedChart props
PropTypeDefaultDescription
childrenrequiredReactNodeThe composed parts — axes, grid, tooltip, legend, and the marks themselves.
configrequiredTConfig & ValidateKeys<TData, TConfig>
datarequiredTData[]The rows the chart draws. One entry per point, bar or category.
titlerequiredstringWhat the chart shows, in a sentence a reader could act on. Required, and announced to a screen reader even when it is not printed.
animationTypeChartRevealType'forward'
barCategoryGapnumber
barGapnumber
chartPropsComponentProps<typeof RechartsComposedChart>Escape hatch onto the raw Recharts chart element.
classNamestringMerged onto the figure, last, so a call site can size or space it.
curveTypeChartCurveType'linear'How the line between two points is interpolated. Every mark inherits it unless it says otherwise.
defaultSelectedDataKeystring | nullnullThe series lit on first render. Selection dims every other series.
descriptionReactNodeA line under the title — the unit, the window, the caveat.
emptyChartEmptyProps | falseWhat the chart shows when it has nothing to draw. Rendered instead of the plot whenever `data` is empty and the chart is not loading — the state a real dashboard reaches within a week, and the one an empty pair of axes is indistinguishable from a failed load. `false` keeps the axes, for a chart whose emptiness is itself the reading.
hideDataTablebooleanfalseDrops the hidden table view. Only correct when the page prints the data itself.
isLoadingbooleanfalseSwaps the marks for an animated skeleton, keeping the measured height so the page does not jump when the data lands.
loadingBarsnumberHow many bars the skeleton draws.
onSelectionChange(selectedDataKey: string | null) => voidFires when the selection changes, and with null when it is cleared.
showTitlebooleanPrints the title above the plot instead of hiding it from sight.
xDataKeykeyof TData & stringThe row field on the category axis. Needed by the brush and by the table view.

Accessibility

  • title is required; the rows are also rendered as a visually hidden table.
  • One value axis only. A dual-axis chart lets its author choose where the lines cross, which is the single most misleading thing a chart can do.
  • enableHoverHighlight dims every bar outside the hovered column, driven by the chart’s own tooltip index.