首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多级树的d3-2路树的实现

多级树的d3-2路树的实现
EN

Stack Overflow用户
提问于 2015-08-19 12:23:34
回答 1查看 977关注 0票数 0

我指的是d3小部件d3 2路树。我希望树在顶部和底部都能进一步生长,我无法为它形成json数据。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-19 12:44:40

在下面的JSON中,我向父母添加了两个节点,向子节点添加了两个节点:

代码语言:javascript
复制
{
    "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
        }
    ]
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32095441

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档