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

node.sum/count for non-numeric data #176

Open
DDDgfx opened this issue Apr 1, 2021 · 0 comments
Open

node.sum/count for non-numeric data #176

DDDgfx opened this issue Apr 1, 2021 · 0 comments

Comments

@DDDgfx
Copy link

DDDgfx commented Apr 1, 2021

when using d3.group, or the previous d3.nest, and passing to d3.hierarchy, the composition of node.data differs between parent and leaf nodes.

Node.data for leaf nodes contains the key-value pairs from the original flat data, while parent nodes contain an array with a string of the group's name as the first element followed by an array of the children's leaf data.

Creating mouse-interaction, doing key-based joins for animated updates hierarchical layouts and force diagrams is difficult because parent nodes don't contain an id other than the function created d.index, or any of the fields from the nodes.

Could a function like .sum or .count help? Instead of populating .value with a number, it might populate another property and contain a "name" or id (I might concatenate the names of all parent nodes + the group name), and additional key values for any leaf properties that have shared values among all the leaves.

Or could .data be reformed to have a similar structure in both leaf and parent 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

1 participant