All examples By author By category About

emeeks

Ch. 4, Fig. 24 - D3.js in Action

This is the code for Chapter 4, Figure 24 from D3.js in Action showing a simple stacked graph created using d3.svg.area() and setting its .y() and .y0() functions to derive values based on the stacked value at each point. Note that this does not use d3.layout.stack (which you should seriously consider if you're considering making stacked charts) but that's because the focus here is on understanding how d3.svg.area() works.