Comments (6)
Hi @thomashogema,
I have to admit I have forgotten exactly why this happens. For some reason the d3 tree layout spaces the nodes very weirdly.
To debug I would make the marriage nodes visible and the look into the layout code in d3 to see for which cases it decides to add extra space.
/Erik
from dtree.
Preliminary investigation shows this might be fixable by removing the marriage nodes and positioning married couples next to each other.
from dtree.
Hi @ErikGartner,
I am facing this issue. I have been reading the code for some time now but not able to get how to go with it. Can you guide me a little on how to go with it.
Regards,
Piyush
from dtree.
Hi @piyushparkash,
Are you looking for an explanation on how dtree works so that you can understand the code?
In short:
- dTree converts the given graph (json object) into a d3 tree-graph by inserting hidden nodes representing things as marriages etc.
- After this is done the modified graph is fed into d3 along with custom code for callbacks, styling and other d3 settings.
To see how the graph really looks you can disable the hiding of the nodes with the hidden attribute.
/Erik
from dtree.
Hi @ErikGartner,
We think we are experiencing the same issue - is this issue referring to nodes of a married couple that get pushed apart because of the spacing required for their children?
If so, could you elaborate on what you suggested after your preliminary investigation? Thanks!
from dtree.
Hi all,
I am facing the same issue as the previous commenters, and can provide a minimal example that showcases the problem https://jsfiddle.net/zyxk73te/. In that example, you can see that the 1rst and 4th "Generation 2" couples are quite asymetrical, whereas the 2nd and 3rd couple are fine.
The code for the d3.tree
layout seems to be here but it is a bit too obscure for me to gather any meaningful information...
I'd also like to point out that I've found another d3.tree
"wrapper" to make family trees: https://github.com/trongthanh/family-tree
It uses a horizontal layout instead of a vertical one so things are admittedly quite different, but it does not seem to suffer from the same problem when I feed it the same data as in the example JSFiddle above.
I didn't dig really deep in his code because it is quite different from dTree
's code, but I found this section where he sets a custom tree.separation()
function which is a bit more involved than the one used in dTree
. Could that be a direction to look into?
@ErikGartner regarding the other solution you pointed out in #15 (comment):
Preliminary investigation shows this might be fixable by removing the marriage nodes and positioning married couples next to each other.
How exactly would you go about doing that?
from dtree.
Related Issues (20)
- How to set horizontal and vertical scroll bars instead of click and drag ? HOT 1
- Update Request HOT 1
- Make the graph responsive
- Appreciation HOT 2
- [REQUEST] dotted line for divorced marriage HOT 3
- Uncaught DOMException: Failed to read the 'value' property from 'SVGLength': Could not resolve relative length.
- How can I decrease height of mariagge 2nd line HOT 3
- Cannot read properties of undefined (reading 'transform') - dTree with React HOT 2
- How to use in angular
- left-right tree?
- Missing types file
- Support hover events HOT 1
- Can we add image ? HOT 2
- Can we Add Image of person in the Node? HOT 2
- Has Anybody use sql to store and retrieve Tree data from database ?
- Reference error _ is not defined. HOT 2
- Complete basic example somewhere? HOT 5
- Add Parent, chilld or reload tree when data change HOT 1
- Onclicking the node change its class HOT 2
- Brother and sisters without parents
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtree.