AdeelK93 / collapsibleTree

Create Interactive Collapsible Tree Diagrams in R using D3.js
https://adeelk93.github.io/collapsibleTree/
158 stars 41 forks source link

Collapse/Expand till a specific level #43

Closed mangupedia closed 6 years ago

mangupedia commented 6 years ago

Hi Adeel,

Can we parametrize/configure node level expand/collapse the tree on load? The current "collapsed=TRUE/FALSE" does expand/collapse all.

AdeelK93 commented 6 years ago

Hi @mangupedia, I've added this feature in the latest github version. You can now map a logical data point to the collapsed option to conditionally collapse the tree. Check it out and let me know what you think!

zac-garland commented 5 years ago

Hi @AdeelK93 could you provide an example of this? I've tried to implement this in all of the variations of collapsibletree e.g. (network, summary, collapsibletree) and have not been able to get it to work.

a simple example that I thought would work given the commits and docs:

collapsibleTree(
  warpbreaks, c("wool", "tension"),
  fill = brewer.pal(9, "RdBu"),
  collapsed = c(sample(c(T,F),9,replace = T)),
  fillByLevel = FALSE
)