react-d3-tree icon indicating copy to clipboard operation
react-d3-tree copied to clipboard

Hiding virtual root node / multiple root nodes

Open kafkas opened this issue 6 years ago • 3 comments

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.

kafkas avatar Jul 23 '19 14:07 kafkas

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  
}

TomlDev avatar Aug 30 '19 10:08 TomlDev

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.

tarzak avatar Jan 12 '23 16:01 tarzak

I could use a feature like this as well.

The24thDS avatar Jan 25 '23 19:01 The24thDS