Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodePadding as a function? #60

Open
curran opened this issue Aug 16, 2018 · 2 comments
Open

nodePadding as a function? #60

curran opened this issue Aug 16, 2018 · 2 comments

Comments

@curran
Copy link

curran commented Aug 16, 2018

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.

image

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.

@mbostock mbostock changed the title Feature Request: nodePadding as Function nodePadding as a function? Sep 1, 2019
@mbostock
Copy link
Member

mbostock commented Sep 2, 2019

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?

@ogelin
Copy link

ogelin commented Nov 17, 2020

+1 on this request. It would be nice to help to nicely vertically align nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants