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
518 stars 135 forks source link

Allow for complete lineage of spouse in marriage. #32

Open ErikGartner opened 8 years ago

ErikGartner commented 8 years ago

As of now the spouse to a node can't have their lineage in the graph.

anatoliegolovco commented 8 years ago

As an discussion kick off point:

  1. kids are result of two biological entities male and female which may or may not be married.
  2. sometimes kids are adopted and it's more relevant by whom they was growth, marriage. It could be both or single parent adoption.

My proposal is to have two kind of links:

if kid is adopted biological link will point to him while he is under family link. (we can use some kind of dash array line)

ErikGartner commented 8 years ago

This is not an easy matter for two reasons:

  1. I want to keep the library easy to use for the most common use cases, while adding support for more advanced customisation.
  2. Visualising complex family trees is really hard and keeping the tree understandable and pretty is not always trivial.

One way would be to do add two things:

  1. Make all lines customisable using CSS-classes, just like the nodes are already. That way certain lines could be made into dash-arrays by setting the class of the line. If someone wants to signify an adopted child, then make the line in a different color or dashed.
  2. Add option to add auxiliary connections between nodes. Allow any node to connect with any other node or marriage. That way a spouse could have a link to another node somewhere. However making sure this line doesn't overlap with other might be hard and figuring out how to referrer to other nodes in the json format is also a problem.
pthorson commented 8 years ago

Here is a sample of a genogram showing an adoption: http://www.genopro.com/genogram/Sample.aspx. the connection to the new family is with a sort of freeform looking dotted line between the person and the other tree.

One other complication to throw into the mix, the adoptive and biological families may not know much about each other or may even be forbidden from being given information about each other (closed adoption).

ErikGartner commented 8 years ago

Thanks for you input @pthorson!

I've also done some thinking. The way I see it the next step probably is to solve issue #30 (live editing). Because with that feature the user could:

  1. Add lineages to both side to the marriage. This would probably make for a pretty complex (if not messy) JSON format, that would be easier to generate through a graphical interface or an API.
  2. Add custom lines, such as adoption lines. Possibly using a point a click system and giving the line a CSS class, that's probably the easiest way to prevent overlaps.

Both would require changes to the underlying JSON data format so that data files are generated through the graphical interface or through an API with calls such as:

father = node("father")
mother = node("mother")
child = node("child")

marriage = father.marry(mother)
marriage.add_child(child)

/Erik

pthorson commented 8 years ago

And I would need to have #31 resolved to actually make use of it since our client is currently standardized on IE11.

kobbe0 commented 7 years ago

Would be great to have lineage of spouse. Any idea when it can be fixed? :)

ucay commented 7 years ago

Add custom lines, such as adoption lines. Possibly using a point a click system and giving the line a CSS class, that's probably the easiest way to prevent overlaps.

I love this. :+1:

xiroV commented 7 years ago

I discovered that this feature was missing after checking dTree out for half an hour. It is sad that this feature is missing, as it would provide me with exactly what I need.

However, I also understand that this is a complex problem, especially if you want to avoid that the library becomes too difficult to use.

Personally, I would love to have the possibility to use API calls, as you mention @ErikGartner . It isn't that I don't like JSON, but as you said, there's a chance that the format will become very messy if you would want to implement this feature. Furthermore, if using data from a database which doesn't store data in a JSON-like format, it would also be much easier with an API to generate the tree.

Otherwise (now I'm just throwing it out there), if you want to keep the current format, but implement lineage for spouses, one possibility (the only I can think of), is to implement a way to add parents for a person, the same way as it is possible to add spouses and children.

Another way, which on the other hand would require some alternation of the current format, would be a way to add id's or weights to each person, and making it possible to refer to these at some other point. So basicly I'm talking about merging multiple trees together in this case, opposed to building one single tree from inside-out in the previous case.

Either way, I'm sure it will become messy. So basicly, as a user: I'm voting for the API.

Please note that I didn't read any of your codebase, so I don't know if I'm way off or anything. I just felt like sharing my thoughts, as this is something I've been thinking about alot.

I hope you come up with a great solution.

Best Brian

ErikGartner commented 7 years ago

Thanks @xiroV for you thoughts.

I agree with your analysis that adding the functionality to the JSON/Javascript object would make the format messy. Guess the least messy way would be to merge multiple trees by id since it doesn't require changing the format that much.

That shouldn't preclude an API though and I think having both would be the best.

/Erik

xiroV commented 7 years ago

I completely agree. Wish I could contribute, especially with the API, but sadly JS isn't really my strong suit.

Brian

ErikGartner commented 7 years ago

Thanks for you input @xiroV. Unfortunately I'm very busy right now but I appreciate the feedback. 👍

imiten commented 6 years ago

family 1: Raj, Rina parents Seema (girl), Rohan(boy) siblings/children

family 2. Yash, Jhanvi parents Rina (girl), Vaibhav (boy).

family 1 Seema marries to family 2 Vaibhav. how is this to be represented using json ?

I suppose this issue is for similar thing but could not quite understand the meaning of word lineage. Also currently from json I understand there is no link its just nesting that decides the relationship. two top level families there is no way to show relation between them ?

xiroV commented 6 years ago

@imiten Unfortunately this is exactly what this issue is about. As the issue is still open, I figure no one have fixed it yet. Hence, my guess is that what you're trying to do is not currently possible.

sinky commented 6 years ago

https://www.myheritage.de/ has a tree like that. Maybe you can find inspiration there.

joepagan commented 4 years ago

Just going to highlight that this exists: https://live.yworks.com/demos/layout/familytree/index.html

Update: It does seem to deal with marriages, looks perfect, the guys on support are nice but turns out you need £12k for the license which isn't great for personal use, but, you might be able to reverse engineer it to implement some ideas here.