d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.48k stars 310 forks source link

stackOffsetDiverging #96

Closed mbostock closed 7 years ago

mbostock commented 7 years ago

A bit like the stackOffsetNegative here:

https://bl.ocks.org/mbostock/b5935342c6d21928111928401e2c8608

But I think this could be improved as follows: make two passes over the data, first dealing with any negative values, and second dealing with positive (or zero) values. Both passes are done using the passed in order, so it won’t require any specific ordering of series, and it also won’t require that series be either exclusively-negative or exclusively-positive. Instead each column is processed independently, with all negative values stacked below zero and all positive values stacked above zero. But within negative values and within positive values, the specified order is observed.

mbostock commented 7 years ago

Related #95.