d3-sankey
d3-sankey copied to clipboard
nodePadding as a function?
It would be great to be able to pass a function into nodePadding, so that different nodes can have different padding.
My particular use case for this is showing hierarchical data, for which the nodes on the top level have a larger font size than the ones in the lower level.
Currently with a global nodePadding value, the padding is driven by the larger font size, and leaves unnecessary space between the nodes with the smaller font size.
Related, I just fixed #63 where if the padding was too large resulting, we’d produce negative node heights. If we make the padding variable for each node, the fix for large values will presumably be more complicated. Also, what’s the desired behavior when two adjacent nodes have different padding? Use the maximum of the two similar to CSS margin-collapse?
+1 on this request. It would be nice to help to nicely vertically align nodes.