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

Parents of spouses #78

Open curtisdelicata opened 6 years ago

curtisdelicata commented 6 years ago

Does this support showing the parents of spouses? I've got it working with Vue for default data but unsure of the JSON?

aroraank commented 6 years ago

Did you find any way to add parents of spouses?

ErikGartner commented 6 years ago

Sorry, I don't have the time to work on new features for dTree. Feel free to make a pull request if you have a good solution :)

saqibameen commented 5 years ago

@curtisdelicata @aroraank Did you find any solution?

ErikGartner commented 5 years ago

No, unfortunately I don't have time right now to add new features to dTree. If you implement the feature be sure to make a pull request!

saqibameen commented 5 years ago

@ErikGartner can you give me some direction in implementing this feature?

ErikGartner commented 5 years ago

The problem with implementing parent support is that dTree uses d3 as its underlying layout engine. Therefore the family tree can't have multiple roots as would be required.

So as I see it you have to writing a custom layout algorithm.

saqibameen commented 5 years ago

I was thinking on the same grounds. That's gonna take a lot of time.

Is there any way we can build separate tree for the parents of spouse and connect the nodes?

ErikGartner commented 5 years ago

You could build separate trees but then you still have to do some calculation for where to lay them out without overlapping which is the tricky part.

I would start with experimenting by building multiple trees in the same SVG and then figuring out how to align them. And then calling the function in dTree to connect the nodes between the trees.

I know I'm being vague but there are many steps to solve this problem which require some serious thought and unfortunately I do not the time required to give better guidance.

Best of luck!

saqibameen commented 5 years ago

That makes sense. There's a lot to figure out to make it work. If I come up with a solution will definitely share with you. Thanks

georg-braun commented 4 years ago

Hey, maybe this will help you.

I used dTree to build my own family tree. But I also wanted to be able to show the parents of the spouses. So I wrote a little converter that converts a family graph data structure to a tree structure with the selected root node. https://www.npmjs.com/package/graphtodtreeconverter

You can find the usage of the converter in this example https://stammbaum.georg-braun.de/ Spouses with parent information are highlighted with a red border. A left click on the node will change the family tree to "another" tree.

ErikGartner commented 4 years ago

@velox1992 Very cool solution and also good for making large graphs manageable!

DucNguyenPTIT commented 4 years ago

@ErikGartner how about considering parents as children and drawing accordingly, but then rotating them upward?

ErikGartner commented 4 years ago

Then you would impose the same restriction on the children instead of the parents.