Stacked and percent area
Use it when the total and its make-up both matter, such as conversations per week by theme. Stacked shows how much; switch to share of total to see which themes are gaining ground whatever the volume. Name the larger bands at the right edge as well as in the legend, so people do not have to hunt for them.
How to use it
Paste the toolkit from Get the code into your page first, then call the chart like this.
const chart = areaChart({
xs: weeks, // ['2026-08-03', '2026-08-10', ...]
xlabel: (w, i, isTooltip) => (isTooltip ? 'Week of ' : '') + fmtDate(w),
mode: 'stacked', // or 'percent'
direct: true, // name the bands at the right edge
series: [
{ name: 'Renewals', colour: catColor('Renewals'), values: renewalsPerWeek },
{ name: 'Payments', colour: catColor('Payments'), values: paymentsPerWeek },
{ name: 'Other themes', colour: 'var(--c9)', values: otherPerWeek }
],
yfmt: v => String(v),
label: 'Conversations per week by theme',
empty: 'No conversations in this range'
});
document.querySelector('#host').append(chart);Options
What you can pass to this chart.
xs
Array of x values (strings). Any length, including 0 or 1.
series
[{ name, values, colour }], stacked in order from the bottom.
mode
'stacked' (default) or 'percent' for each x as a share of 100%.
direct
True to name each band at the right edge. Bands too thin to hold a label are skipped, so keep a legend as well.
xlabel
(x, i, isTooltip) => string. Short label for the axis, long label for the tooltip.
yfmt, tipfmt, height, maxLabels
Number formatters and sizes. Pass your own yfmt: the default is in pounds.
label / empty
aria-label for screen readers; text shown when there is no data.
More charts like this
Other charts in the “Over time” group.
Want charts or dashboards like these in your own product?
Tell me what you are trying to see and I can help work out the right approach, from the data behind it to the screen in front of people.