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

Using d3.stratify together with the flextree hierarchy #13

Open
karlitos opened this issue Sep 25, 2018 · 1 comment
Open

Using d3.stratify together with the flextree hierarchy #13

karlitos opened this issue Sep 25, 2018 · 1 comment

Comments

@karlitos
Copy link

My tree-data lies as a plain array at the beginning, so converting to a nested structure is necessary before processing with flextree.

If I use the d3.stratify function it creates a nested structure with the data property containing all the original properties of every node. If I then call the layout.hierarchy on this data it crates a new hierarchy containing the data property containing the data property containing all the original properties 😞

If I call layout directly on the stratified data the resulting layout does not have the right properties.

So shat I was forced to do instead was using different function to create the nested structure (see list-to-tree-lite) to create the flextree hierarchy to compute the layout.

It would be great if the flextree would be able to implement the d3.stratify function as well or at least operate on the stratified data with an option to re-use the data property.

@michaeljohansen
Copy link

Just skip the layout.hierarchy() step and go straight to layout() :)

"Computing the layout of a tree data structure involves two steps: first, create a hierarchy from the data, and second, invoke the layout function." (source)

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

No branches or pull requests

2 participants