This post describes how to build a very basic
stacked area chart with d3.js. A
stacked area chart allows to visualize the evolution of a numeric
variable for several groups. You can see many other examples in the
stacked area chart section of the
gallery. Learn more about the theory of stacked area chart in
data-to-viz.com. This example works with d3.js v4
and v6
div
that will be modified by d3 later on.
svg
area. It specify the chart size and its
margin. Read more.
d3.stack()
function.
path
, using the
d3.area()
helper.