Closed mbostock closed 8 years ago
There is an eerie similarity between pie layout, stack layout, and ordinal range bands. They do such similar things, and padding seems relevant to all of them. I wonder if they could be somehow unified..
For example, might it make sense to add padding logic (innerPadding, outerPadding) in the stack layout, which would be very similar to the padding logic of pie layout and ordinal range bands.
I'm not sure, maybe there are too many use-case-specific things across these different APIs and unifying them doesn't make sense, but I thought I'd just put in my 2¢. Related to https://github.com/d3/d3-shape/issues/41
All could be considered ways of dividing 1-dimensional space, but I think they are sufficiently different to justify their independence.
For instance: The pie generator has several characteristics are specific to dividing an angular domain. ordinal.rangeBands doesn’t divide by value, but instead divides the area uniformly. And I don’t think the area generator should support padding, since that would apply a vertical offset between layers:
You’re more likely to want a stroke to separate layers (albeit at the expense of penalizing the thin layers and spikes):
Likewise the stack layout understands how to compute a moving baseline, something that seems like overkill for the pie layout.
Thank you for your thoughts on this.
I did an experiment to see how padding might look for streamgraphs:
This has a different quality than your example with jagged breaks. It's almost like it makes the absence of certain segments more pronounced. This is a different effect than you'd get by adding stroke to the layers.
Fixes #32. TODO:
vs. “values”APIhandle negative dy?No; that should be done as a separate stack.handle NaN dy?Deferred to #51.