如果没有明确声明的root,你如何实现边缘捆绑?

时间:2015-03-10 01:51:40

标签: javascript json svg d3.js bundle-layout

我目前正在尝试为包含国家/地区及其贸易伙伴的.json文件实施边缘捆绑。但是,我很难理解如何使用我当前拥有的数据创建层次结构,正如Mike Bostock所做的那样here

enter image description here

以下是我的数据文件的代码段:

[
    {
        "name": "Angola",
        "alpha2_code": "ao",
        "country_id": 4,
        "longitude": 13.242,
        "years": [
            {
                "gdp": 12650000000.0,
                "life_expectancy": 42.0514634146341,
                "top_partners": [
                    {
                        "total_export": 2036096161.9550002,
                        "country_id": 223
                    },
                    {
                        "total_export": 224173637.056,
                        "country_id": 50
                    },
                    {
                        "total_export": 158327929.5,
                        "country_id": 16
                    }
                ]
            }
        ]

0 个答案:

没有答案