我是 json 新手,我想创建一个 HighChart,我有 JSON 格式的数据,我已将其转换为表格格式 [下面是从 JSON 中提取的数据和列]。
地点日期范围点击次数
雅虎搜索 2010-04-01 2172
谷歌 2010-04-01 10830
MSN 2010-04-01 555
SSP 2010-04-01 0
雅虎搜索 2010-04-02 1746
谷歌 2010-04-02 8508
MSN 2010-04-02 477
谷歌 2010-04-03 5061
雅虎搜索 2010-04-03 1113
MSN 2010-04-03 192
我想以以下格式创建一个 JSON 字符串。我该怎么做
xAxis: {categories: ['2010-04-01', '2010-04-02', ' 2010-04-03']},
series: [{
name: 'Yahoo Search',
data: [2172 ,1746,1113]
},
{
name: 'Google',
data: [10830,8508,5061]
},
{
name: 'MSN',
data: [555,477,792]
},
{
name: 'SSP',
data: [0,0,0]
}]
我的 json 数据在这里
{"schema":{"fields":[{"name":"NM_Venue","type":"STRING","mode":"NULLABLE"},{"name":"NM_DateRange","type":"STRING","mode":"NULLABLE"},{"name":"M_Clicks","type":"INTEGER","mode":"NULLABLE"}]},"totalRows":"10","rows":[{"f":[{"v":"Yahoo Search"},{"v":"2010-04-01"},{"v":"2172"}]},{"f":[{"v":"Google"},{"v":"2010-04-01"},{"v":"10830"}]},{"f":[{"v":"MSN"},{"v":"2010-04-01"},{"v":"555"}]},{"f":[{"v":"SSP"},{"v":"2010-04-01"},{"v":"0"}]},{"f":[{"v":"Yahoo Search"},{"v":"2010-04-02"},{"v":"1746"}]},{"f":[{"v":"Google"},{"v":"2010-04-02"},{"v":"8508"}]},{"f":[{"v":"MSN"},{"v":"2010-04-02"},{"v":"477"}]},{"f":[{"v":"Google"},{"v":"2010-04-03"},{"v":"5061"}]},{"f":[{"v":"Yahoo Search"},{"v":"2010-04-03"},{"v":"1113"}]},{"f":[{"v":"MSN"},{"v":"2010-04-03"},{"v":"192"}]}],
"result":{"schema":{"fields":[{"name":"NM_Venue","type":"STRING","mode":"NULLABLE"},{"name":"NM_DateRange","type":"STRING","mode":"NULLABLE"},{"name":"M_Clicks","type":"INTEGER","mode":"NULLABLE"}]},"totalRows":"10","rows":[{"f":[{"v":"Yahoo Search"},{"v":"2010-04-01"},{"v":"2172"}]},{"f":[{"v":"Google"},{"v":"2010-04-01"},{"v":"10830"}]},{"f":[{"v":"MSN"},{"v":"2010-04-01"},{"v":"555"}]},{"f":[{"v":"SSP"},{"v":"2010-04-01"},{"v":"0"}]},{"f":[{"v":"Yahoo Search"},{"v":"2010-04-02"},{"v":"1746"}]},{"f":[{"v":"Google"},{"v":"2010-04-02"},{"v":"8508"}]},{"f":[{"v":"MSN"},{"v":"2010-04-02"},{"v":"477"}]},{"f":[{"v":"Google"},{"v":"2010-04-03"},{"v":"5061"}]},{"f":[{"v":"Yahoo Search"},{"v":"2010-04-03"},{"v":"1113"}]},{"f":[{"v":"MSN"},{"v":"2010-04-03"},{"v":"192"}]}]}}