【发布时间】:2018-04-15 21:12:17
【问题描述】:
我正在学习本教程:
https://bl.ocks.org/denjn5/3b74baf5edc4ac93d5e487136481c601
它工作正常,但只有两个“环”数据。我想添加第三个。它正在使用以下数据从 data.json 文件中提取数据:
{
"name": "TOPICS", "children": [{
"name": "Topic A",
"children": [{"name": "Sub A1", "size": 5, "text": "A story", "sentiment": 1, "source": "dictionary"},
{"name": "Sub A2", "size": 5, "text": "A note", "sentiment": 0.5, "source": "dictionary"}]
}, {
"name": "Topic B",
"children": [{"name": "Sub B1", "size": 5, "text": "A vignette", "sentiment": 1, "source": "newspaper"},
{"name": "Sub B3", "size": 5, "text": "A joke", "sentiment": 0.5, "source": "email"}]
}, {
"name": "Topic C",
"children": [{"name": "Sub A1", "size": 5, "text": "A narrative", "sentiment": 1, "source": "newspaper"},
{"name": "Sub A2", "size": 5, "text": "A chronology", "sentiment": 0.5, "source": "email"}]
}]
}
我的问题是,如何在外面添加第三圈数据?这似乎是 JSON 格式,但我无法理解它。
【问题讨论】:
标签: javascript json d3.js graph