danielcaldas / react-d3-graph

Interactive and configurable graphs with react and d3 effortlessly
https://danielcaldas.github.io/react-d3-graph/sandbox/
MIT License
821 stars 232 forks source link

Root node collapses and hiddens #168

Open VBagmut opened 5 years ago

danielcaldas commented 5 years ago

This is a know limitation for collapsible graphs. Unfortunately, there is not a straightforward way to detect a root node. This would require something like a graph to tree conversion which could be costly. Since you raised this issue, let me take the opportunity to ask the community.

Would you be willing to tag the root node as root: true in order to avoid this undesirable behavior? Or, do you have any other ideas on how we could tackle this problem? @VBagmut @LonelyPrincess

pushpinder107 commented 4 years ago

How about adding a prop to the node like collapsible: false so that non-root nodes can also stopped from collapsing? I can give a PR with this change if needed.

danielcaldas commented 4 years ago

Hey, @pushpinder107 that's a good idea! That way any node can be controlled by the client in terms of whether it should or not be collapsible!

Reopened the issue, a PR would be very welcome @pushpinder107 🙂