Skip to main content

Area chart

One key series over a flat tint.

Guidance​

Area charts show one quantity over time, such as assets catalogued per day, as a key line over a flat 10% tint of the same colour, never a gradient. They carry the key series only: when you need context series, use mm-line-chart. The fill runs down to zero, so the range-frame y axis spans zero to the maximum, labelled at both ends, with at most three dotted gridlines and no box. Estimated trailing points (estimated) are dashed and hatched instead of tinted, and annotations take the same leader and dimension-bracket notes as the line chart.

Keyboard: Tab to the chart, then Left and Right move between points and show the tooltip; Home and End jump to the ends; Escape hides the tooltip.

Properties​

PropertyAttributeTypeDefaultDescription
valuesvalues(number | null)[][]One value per x, oldest first. null leaves a gap.
namenamestring''Series name, printed at the line end, e.g. "Catalogued". Defaults to label.
xxXValue[][]The x values, oldest first: Dates, ISO strings or numbers. Times are formatted in time-zone.
unitunitstring''Unit after each value, after a non-breaking space, e.g. "ms".
estimatedestimatednumber0How many trailing points are estimated (an incomplete hour or day). They are dashed and hatched.
annotationsannotationsChartAnnotation[][]Point annotations and ranges such as an incident window.
xLabelx-labelstring''Heading for the x values in the tooltip and the data table.
timeZonetime-zonestring'UTC'IANA time zone for time labels. UTC by default so server and browser agree.
labellabelstring''What is measured, in sentence case, e.g. "Queries per hour". Starts the summary sentence and names the table.
summarysummarystring''Replaces the generated summary sentence read by screen readers.
heightheightnumber240Plot height in px.
defaultWidthdefault-widthnumber640Width used before the first measurement and on the server, in px.
loadingloadingbooleanfalseShows the topographic loading field (after 200ms, for at least 400ms).
errorerrorstring''An error sentence. When set, the chart draws its empty frame with this sentence.
emptyTextempty-textstring''Sentence shown when there is no data.
tonetone'primary' | 'info''primary'Key series colour: primary (burnt sienna, default) or info (slate). The only colour on the chart.
activeIndexnumberIndex of the focused or hovered data point, or -1.

CSS parts​

PartDescription
frameThe focusable plot region.
plotThe SVG drawing.
messageThe empty or error sentence.

CSS custom properties​

PropertyDescription
--mm-chart-keyColour of the line and its tint.
--mm-chart-groundThe ground behind the chart, used for label halos. Defaults to --mm-paper.

Examples​

Every state of mm-area-chart in Storybook, with keyboard and screen reader tests.