This post describes how to build a very basic stacked area chart with d3.js. Note that input dataset is at the wide (untidy) format: each group is provided in a specific column. See another basic example starting from long (tidy) format here. You can see many other examples in the stacked area chart section of the gallery.
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.