-
Notifications
You must be signed in to change notification settings - Fork 313
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
stratify.path #185
stratify.path #185
Conversation
Demo here: https://observablehq.com/d/067a15f32eee749a I think d3.stratify should not impute a root node "/" if there is only one explicit root (e.g., "/flare"). Update: done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some documentation.
Would it make sense to accept the path being returned as an array?
with data = [{path: "a,b,c,d,e,f"}, ...]
, we could say d3.stratify().path(d => d.path.split(","))(data)
this would avoid massaging a string and having to escape existing slashes in the identifiers.
Maybe. At the least if we don’t, we should allow escaping of backslashes… I can try to do the array-based approach. I think we’ll still need some normalization so that "/foo/bar".split("/") and "foo/bar".split("/") are considered equivalent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
This new d3.stratify feature imputes internal nodes using the specified path function, which returns slash-separated ids (as per a typical UNIX-y file system). Alternative to #184. Fixes #33.