ErikGartner / dTree

A library for visualizing data trees with multiple parents, such as family trees. Built on top of D3.
https://treehouse.gartner.io/ErikGartner/58e58be650453b6d49d7
MIT License
521 stars 139 forks source link

Hiding node functionality #69

Closed osya closed 5 years ago

osya commented 6 years ago

It were impossible to add only one parent. I fixed it via adding foo parent and hiding it.

ErikGartner commented 6 years ago

Hi @osya!

Thanks for the pull request and engaging with the dTree community!

Having a single parent is however already possible. It's a bit unclear from the documentation (in fact it maybe undocumented, my bad!) but by adding the children into the node of a parent directly the children will descend from that parent.

Like this:

{
  name: "Father",                
  class: "node",                   
  textClass: "nodeText",        
  children: [{                          // List of children nodes
      name: "Child",
    }]
}]

I'll have to have a closer look if this new solution is better. Either way I think the old notation is better rather than hiding the other parent using a special attribute.

/Erik

osya commented 6 years ago

Hello, @ErikGartner

Thanks for your clarification. You solution for one-parent by placing children node just under person's node is worked. According to this PR I can say the following: