Multiple parents for a child in familytree chart in GOJS

时间:2015-09-14 15:49:13

标签: javascript family-tree gojs

How can I add multiple parent for a child node in family tree diagram in GOJS. Are there any parameters or any lines of codes to do so ?

I want to generate image like below.

enter image description here

1 个答案:

答案 0 :(得分:1)

Do you mean something like http://gojs.net/latest/samples/genogram.html? That is what most people use when they want to show both parents as separate nodes, potentially each with their own relationships.

The http://gojs.net/latest/samples/familyTree.html sample uses a TreeModel, not a GraphLinksModel, so it cannot describe a graph where nodes might have multiple "tree" parents. You have to use a GraphLinksModel for what you describe.

Furthermore, that Family Tree sample uses TreeLayout, which only works well on tree-structured graphs. You want to use LayeredDigraphLayout instead.

So to get what you have drawn, use a GraphLinksModel and LayeredDigraphLayout.