【发布时间】:2018-11-21 17:33:52
【问题描述】:
我的一部分 JSON 数据如下。
[
{
"App": "app1",
"count": 8,
"country": "FR",
"period": "2018"
},
{
"App": "app2",
"count": 7,
"country": "FR",
"period": "2018"
},
{
"App": "app3",
"count": 12,
"country": "FR",
"period": "2018"
},
{
"App": "app4",
"count": 2,
"country": "FR",
"period": "2018"
},
{
"App": "app5",
"count": 25,
"country": "FR",
"period": "2018"
},
{
"App": "app6",
"count": 49,
"country": "FR",
"period": "2018"
},
{
"App": "app7",
"count": 5,
"country": "FR",
"period": "2018"
},
{
"App": "app8",
"count": 189,
"country": "FR",
"period": "2018"
}
]
.
我想为这个 JSON 数据绘制一个树形图,看起来像这样:
树状图是根据不同应用的计数值绘制的。国家和时期可以忽略。
我找到了此文档Populating Data 但问题是 DataTable 必须采用与我的 DataTable 不太相似的特定格式。请建议我如何使用 d3.js 或 Google 图表来做到这一点?
【问题讨论】:
-
您可以执行类似于this answer 的操作,其中问题与您提供的示例相同...
标签: javascript angularjs json d3.js google-visualization