-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guide to Insert|Delete|Update node #1
Comments
Hi @dariush-fathie, first of all, I apologize for the late answer. For some reason I did not receive a notification by Github. I hope I will next time! To your question: data = {
"persons": {
"id1": { "id": "id1", "name": "Adam", "birthyear": 1900, "deathyear": 1980, "own_unions": ["u1"] },
...
},
"unions": {
"u1": { "id": "u1", "partner": ["id1", "id2"], "children": ["id3", "id4", "id11"] },
...
},
"links": [
["id1", "u1"],
["u1", "id3"],
...
]
} All data is stored in one object called Let's assume, you want to add a person "George" to the tree. To keep things simple, let's assume that "George" is the child of "Adam" and "Berta" from the existing dataset and George has no partner or children. Now, to add George, you first add a line to the "something": { "id": "something", "name": "George", "birthyear": 0, "deathyear": 100, "own_unions": [] } As you can see, the "u1": { "id": "u1", "partner": ["id1", "id2"], "children": ["id3", "id4", "id11", "something"] }, This step makes sure that George will be considered the child of Berta and Adam. Unfortunately, this is not enough to make sure that a connection will be drawn in the tree. For this to happen, one extra step is necessary: You have to add a ["u1", "something"] You can see that the file format contains redundant information, which makes it a little cumbersome to manipulate. This is something that I would like to change in the long run. If you figure out an easier way, let me know ;) To delete a node, you would have to delete the entry in the I hope this helps you to set up your own tree. Let me know how it goes! Cheers, |
Thank you Ben |
HI
YOU ARE AMAZING
It is the most beautiful tree I found.
In fact, I am new to d3 world and if you can help me how to insert child node or delete or update I will appreciate you
Anyway THANKS
The text was updated successfully, but these errors were encountered: