Gikar
Gikar

Reputation: 219

Implementing d3-2way-tree for multilevel tree

I was referring to d3 widget, d3 2 way tree . I want the tree to be grown further more both at the top and bottom, i am not able to form the json data for it.

Upvotes: 0

Views: 994

Answers (1)

codename44
codename44

Reputation: 887

In following JSON, I added two nodes to parents and two nodes to children :

{
    "name": "Airlines",
    "parents": [
        {
            "name": "Aviation",
            "isparent": true
        },
        {
            "name": "Transparent_companies",
            "isparent": true
        },
        {
            "name": "Transport_operators",
            "isparent": true,
            "parents": [
                { 
                    "name" : "parent-foo1",
                    "isparent" : true
                },
                { 
                    "name" : "parent-foo2",
                    "isparent" : true
                }
            ]
        }
    ],
    "children": [
        {
            "name": "Airline_alliances",
            "isparent": false
        },
        {
            "name": "Airlines_by_continent",
            "isparent": false
        },
        {
            "name": "Airlines_by_type",
            "isparent": false,
            "children": [
                { 
                    "name" : "children-foo1",
                    "isparent" : false
                },
                { 
                    "name" : "children-foo2",
                    "isparent" : true
                }
            ]
        },
        {
            "name": "Defunct_airlines",
            "isparent": false
        }
    ]
}

Upvotes: 1

Related Questions