Collapsible tree example
See original GitHub issueI derived a simple example from https://vx-demo.now.sh/trees available here: https://codesandbox.io/s/n3w687vmqj
I’m not overly happy with the forceUpdate()
and would like to have it animate similar to https://bl.ocks.org/mbostock/4339083, but it’s a start
Issue Analytics
- State:
- Created 6 years ago
- Comments:28 (5 by maintainers)
Top Results From Across the Web
Collapsible Tree / D3 - Observable
Click a black node to expand or collapse the tree. ... const duration = d3.event && d3.event.altKey ? 2500 : 250;. const nodes...
Read more >Collapsible Tree: Geography Example - Adeel Khan
collapsibleTree is an R htmlwidget that allows you to create interactive collapsible Reingold-Tilford tree diagrams using D3.js, adapted from ...
Read more >Collapsible tree diagram in v4 - gists · GitHub
This is a d3.js tree diagram that incldes an interactive element as used as an example in the book D3 Tips and Tricks...
Read more >Collapsible tree diagram in v7 - Popular Blocks - Mike Bostock
This is a d3.js tree diagram that incldes an interactive element as used as an example in the book D3 Tips and Tricks...
Read more >collapsibleTree: inst/examples/01rmd/Example01.Rmd - Rdrr.io
Collapsible Tree Example 1: R Markdown. In collapsibleTree: Interactive Collapsible Tree Diagrams using 'D3.js'. knitr::opts_chunk$set(echo = TRUE) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hshoff @sghall I’ve made some progress using react-move to animate the expand/collapse animations of a
<Tree />
after the render prop was exposed (thanks again @hshoff )There is still some work to do:
d3.linkVertical
/d3.linkHorizontal
as a custom interpolator for nodes so they slide along the link paths instead of a straight linethis.forceUpdate()
, etc)I currently have it running locally but can move it out to codesandbox.io once a new version of vx-hierarchy is released (I couldn’t figure out how to use a git sha version on codesandbox, and also struggled locally with the same, but ended up getting
npm link
to work and have been tweaking thevx-demo
for Tree).I don’t know if I’ll get much more time to iterate on this till next week so once I get it on codesandbox, feel free to fork and tweak if you want.
I created a radial tree example derived from the cartesian layout version and based on the Radial Tidy Tree d3 example
The only changes needed to support this layout was to:
Tree
to the center (i.e<Group top={width / 2} left={height / 2}>
)LinkRadial
from@vx/shape
instead ofLinkHorizontal
for linksd3-shape
to translate the each node’sx
/y
to the radial layout. I also used a simple function to return an{x, y}
object instead of an array of[x, y]
This example also has the same quirks/issues as mentioned in previous comment, but so far I’m really enjoying using vx and react-move together.