Skip to main content
An area chart is a line with the region beneath it filled. Use geom.area() to emphasise magnitude across an ordered or continuous x-axis, and its stacked form for part-to-whole trends.

Basic example

Stacked area

Map a category to color and stack the layers for a part-to-whole trend. In long format, one row per month × region:
'stack' is the area geom’s default position, so the position above is explicit for clarity rather than required. Use position: 'fill' for a 100% stacked area, where each band shows its share of the total, or position: 'identity' to let the bands overlap at their raw values — the shape a filled radar needs.

Points on the area

Add a geom.point() layer to mark every vertex. It shares the spec-level mapping, so both layers plot the same series. Pipe it after the area so the dots sit on top, and set interactive: false on the point layer:
interactive: false keeps the points out of hit-detection so the area owns hover — it resolves the nearest point along the x-axis and drives the tooltip. Interactive points would make hover fire only when the cursor lands directly on a dot. Marker diameter is paint, so it comes from the stylesheetstyle.geom.point({ size }), default 8. Giving the layer an id and scoping the entry with { layer } keeps the size on the dots and off anything else the chart draws. Over a stacked area, give the point layer position: 'stack' too. A point layer defaults to 'identity', so without it the dots plot at raw values and float off the stacked surface:

Area params

geom.area() takes the same curve family as the line, and its own answer for nulls:
'linear' | 'catmull-rom'
default:"linear"
Curve family. 'catmull-rom' smooths the outline through every point.
'zero' | 'connect'
default:"zero"
How the band handles null values: treat them as zero ('zero'), or drop the null rows so the band spans the gap ('connect'). 'gap' is accepted and normalised to 'zero' — an area can’t render a gap mid-stack.

Painting the band

Fill opacity, and the outline’s width, dash and opacity, come from the stylesheet, through the style.geom.area target:
The built-in fill is alpha: 0.3, which is why an area reads markedly lighter than the palette color its legend swatch shows. Raise it to 1 for solid stacked bands. The outline draws at strokeWidth: 2, lineType: 'solid', strokeAlpha: 1. style.geom.area declares color, alpha, saturation, strokeWidth, lineType and strokeAlpha.
  • Styling — the stylesheet, its cascade and every target
  • Line — an unfilled outline, or a fading gradient fill via its fillAlpha style property
  • Geoms & layers — stacking and position modes