org-chart
org-chart copied to clipboard
Two Parent Root
Can create chart with two parent root on top hirarchy ?
No
Can we achieve this Fake multi-rooted tree example http://bl.ocks.org/ialarmedalien/c92a58f2fee695c3931c1b6e30540d98 here in this library @bumbeishvili ?
I guess so
You can just use CSS to hide first node and first two links

it's just SVG
You will probably also need to:
- Decrease first
nodeHeight
- Decrease the first level
childrenMargin
- Set
chart.compact(false)
Thanks! @bumbeishvili
You can just use CSS to hide first node and first two links
@bumbeishvili It seems the order of the links is not guaranteed, though.
I have tried with the following code:
let linkCount = chart.getChartState().root.children.length;
if (linkCount > 0) {
const wrapper = document.querySelector(".links-wrapper"); // or extract from getChartState().linksWrapper, I guess
while (linkCount > 0) {
wrapper.firstChild.remove();
linkCount--;
}
}
Sometimes it does work, but other times the first N links are not those which start from the root.
I have also considered overriding connectionsUpdate
as explained here to prevent their generation altogether, but the state.connectionsUpdate
function / option does not seem to be called at all (I have tried putting debugger
/ alert
into it and they do not seem to get reached).
You can also use chart.connections
to fake multi root