Network Tree not centralized

271 Views Asked by At

I'm tring to build a tree using Vis.js Network, like genealogy tree. I've tried various configurations to draw graph like as tree using Vis.js Network. I've wrote these configs:

{
    "interaction": {
        "zoomView": true,
        "hover": true,
        "dragNodes": true
    },
    "layout": {
        "hierarchical": {
        "direction": "UD",
        "sortMethod": "directed",
        "nodeSpacing": 150,
        "parentCentralization": false
        }
    },
    "physics": {
        "enabled": false
    }
}

and:

{
    "interaction": {
        "zoomView": true,
        "hover": true,
        "dragNodes": true
    },
    "layout": {
        "hierarchical": {
        "direction": "UD",
        "sortMethod": "directed",
        "nodeSpacing": 150,
        "parentCentralization": true
        }
    },
    "physics": {
        "enabled": false
    }
}

But my tree still growing from left to right like showing in image Tree Growing

My data is dynamic, when I click in a node they can expand. If needed I host to better understanding.

At first interaction the tree looks fine.

First interaction

0

There are 0 best solutions below