mode='share' stacks every time to 100%, so the make-up reads the same whether the crowd is big or small. The tooltip gives each layer's share and count, and the table holds shares.
<Chartlabel='Tickets issued by pool'source='Oztix sales.'size='md'>
onRangeSelect lets someone drag across dated x to pick a range, as on LineChart. The range is inclusive, in the venue's wall time: '2026-10-03' for days, or '2026-10-03T18:00' for times. On a dashboard, selectsPeriod passes it to onPeriodChange.
functionZoom(){
const[range, setRange]=useState(null)
return(
<divclassName='grid gap-4'>
<Chartlabel='Tickets sold by channel'source='Oztix sales.'size='md'>
<StackedArea
Guidelines
Use StackedArea when both the total and its make-up matter over time, such as scans by gate. To compare the layers' own trends, use a LineChart; for a few categories rather than a run of time, use StackedBars.
The layer with the largest total stacks at the bottom, where its edge is flat and easiest to read. Other always stacks on top.
Past 6 layers, the smallest roll into Other. The table keeps a column for every layer, plus the total.
A missing reading counts as zero, so the layers above it stay joined.
The x axis reads like LineChart's: dates, numbers, or xFormat='daysOut' and xFormat='eventTime'.
With onRangeSelect, releasing a drag reports the range and leaves it drawn until a click on the plot, Escape while the chart has focus, or data with different x values. Touch only scrolls and shows the tooltip, so pair the chart with a DateRangePicker for phones.
Accessibility
The plot is one tab stop. Left and right arrows move between times, and up and down between layers at the same time. Each value is read out in plain words, such as "Saturday, 14 November 2026, 7:00pm, 48 scans, Main gate". In share mode it ends with the layer's share, such as "71% of the total".
With onRangeSelect, Shift with the left or right arrow selects from the focused time, and Shift with Home or End selects to either end. The range is read out, such as "Selected Friday, 2 to Sunday, 4 October 2026, 3 days", and Enter applies it. Once there's a range, its start and end handles are sliders in the tab order. Their arrows move them, and Enter applies. Escape clears the range.
The tooltip opens with the total, then lists each layer with a value from the top of the stack down, matching the legend.
The Table tab holds every value, with a Total column. In share mode it holds shares, and the total stays a count.
API reference
StackedArea
dataPlotRow[]
Required
Rows of plain values, one per time and series. Dates are ISO strings in venue wall time.
xstring
Required
Field along the bottom: an ISO date or a number.
ystring
Required
Field for the value each series adds to the stack.
seriesstring
Required
Field that names each layer. Past 6, the smallest roll into Other.
highlightstring | string[]
Layers that tell the story, drawn in the highlight. The rest are context.
palette"categorical" | "pair" | "trio"
Defaults to 'categorical', or the pair or trio set at 2 or 3 layers.