react-d3-tree
react-d3-tree copied to clipboard
Hiding virtual root node / multiple root nodes
My diagram needs to have multiple root nodes so I've temporarily added a virtual node as a parent of all the root nodes. Is there a way to hide the root node, more importantly, the links belonging to the root?
As a side note, it would be great to have the ability to add multiple roots.
For i child nodes of your root node:
// hides root node
document.getElementsByClassName('nodeBase')[0].style.opacity = 0
for (int i = 0; i < childNodes; i++) {
// hides first i links
document.getElementsByClassName('linkBase')[i].style.opacity = 0
}
good workaround! But it is still better to have ability to have few root nodes. Because with fake hidden root node, there is possible situation, when another two root nodes are placed really close to each other, because they are treated like children of that hidden root. It happens, when one of "root nodes" does not have any child.
I could use a feature like this as well.