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

Additional hierarchy layouts #172

Closed
techniq opened this issue Oct 11, 2017 · 3 comments
Closed

Additional hierarchy layouts #172

techniq opened this issue Oct 11, 2017 · 3 comments

Comments

@techniq
Copy link
Collaborator

techniq commented Oct 11, 2017

I created three new vx components for the remainder of the d3-hierarchy layouts.

<Pack />

<Partition />

<Treemap />

Recommended API change

  • Only pass data to children render function for all hierarchy components instead of calling data.links(), data.descendants(), data.leaves() and passing each of them explicitly. I haven't measured, but I'm expecting an incurred cost for each call, and don't expect a user to need both descendants or leaves in the same visualization, for example.

I'll try to submit a PR with these 3 new layout components to vx-hierarchy package, but maybe someone else could create some prettier examples for the gallery than my d3 ported ones? It would also probably be good to put some hierarchical data in vx-mock (maybe the flare.json that d3 uses). It would also be nice to probably create a data generator for this type of data.

I'm next going to start looking at creating an orthogonal link, useful for brackets and possible a curved layout (see this vega example and change the link type). A 45deg elbow would be nice as well. I'm not sure if all of these should be separate components like LinkHorizontal, LinkVertical, and LinkRadial or just a type prop (or something) such as <LinkHorizontal type="orthogonal" />. Thoughts?

@hshoff
Copy link
Member

hshoff commented Oct 11, 2017

Wonderful! these will be excellent and much needed additions.

maybe someone else could create some prettier examples for the gallery than my d3 ported ones?

I'm happy to do this.

It would also probably be good to put some hierarchical data in vx-mock... It would also be nice to probably create a data generator for this type of data

Good idea. I can add this as well. Will try to find some fun data.

I'm not sure if all of these should be separate components like LinkHorizontal, LinkVertical, and LinkRadial or just a type prop (or something)

I like the separate components instead of trying to overload a simple general component. I see your point though and will give this some more thought.

Only pass data to children render function for all hierarchy components instead of calling data.links(), data.descendants(), data.leaves() and passing each of them explicitly. I haven't measured, but I'm expecting an incurred cost for each call, and don't expect a user to need both descendants or leaves in the same visualization, for example.

super agree with this. i will update all of the different layout components in @vx/hierarchy after we land your PR that adds the new components.

Thanks for this! 🙌

@techniq
Copy link
Collaborator Author

techniq commented Oct 12, 2017

One thing I just remembered, in Example.js for Sunburst you'll notice I had to use arc from d3-shape instead of vx's <Arc /> because vx's also uses the pie layout within it.

Maybe worth separating out a <Pie /> component?

@hshoff hshoff closed this as completed in 4545626 Oct 12, 2017
@techniq
Copy link
Collaborator Author

techniq commented Oct 12, 2017

@hshoff Don't miss this comment above ;)

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