ssthouse / tree-chart

Flexible tree chart using Canvas and Svg, powered by D3.js; ✅Support Vue, Vue3 and React;
https://ssthouse.github.io/tree-chart/#/svgTree
MIT License
431 stars 97 forks source link

How to start with nodes collapsed? #114

Open Jont828 opened 2 years ago

Jont828 commented 2 years ago

I would like to pass a field node.collapsed to load a specific node with its children collapsed. This way, for nodes with a ton of children, we can save some screen space. It looks like v-bind:collapsed="node.data._collapsed" and onClickNode() is responsible for setting node.data._collapsed and node.data.children to null. I'm thinking that I could initialize node.data._collapsed and node.data.children for nodes that I want collapsed to begin with. My question is, is there a function where it would make sense to add it?