score:6

Accepted answer

This question is old, but it doesn't have the answer I was looking for. The example that Lars Kotthoff doesn't actually normalize the data as the data is provided as normalized already. To normalize your stack, add .offset('expand') to the stack initialization. Building off the stacked area chart example, the stack initialization would just be the following instead:

var stack = d3.layout.stack()
              .offset('expand')
              .values(function(d) { return d.values; });

Simple, but it took me hours before realizing it was in the documentation. Since this is one of the top results on Google now, hopefully this helps save some time for someone in the future.


Related Query

More Query from same tag