与json的Highcharts玫瑰图

时间:2014-03-25 21:02:33

标签: json highcharts

我有一个php脚本(data.php)从mysql数据库返回以下json数据:

[[0,0.35,0,1.05,1.05,0.7,0.35],
 [0,0.7,0,1.05,1.74,1.74,0],
 [0,2.09,0,0.7,2.09,1.05,0.35],
 [0.35,1.74,0,1.05,1.05,1.05,0.35],
 [0.7,0.7,0,1.05,1.74,1.05,0.35],
 [0,1.05,0,2.09,2.09,1.39,0.7],
 [0,1.39,0,1.39,0.7,1.39,0.7],
 [1.05,1.05,0,1.05,0.35,1.05,0.35],
 [0,1.39,0,0.7,0.7,0.35,0.7],
 [0.35,0.7,0,0.7,0.35,1.39,0.7],
 [0,2.09,0,1.05,1.74,1.05,0],
 [0,1.05,0,1.05,1.05,0.7,0.35],
 [0.35,1.05,0,1.74,1.74,1.39,0.35],
 [0,1.05,0,1.39,1.74,1.05,0.35],
 [0,1.39,0,1.39,0.7,0,0.35], 
 [0,0,0,1.74,2.09,0.35,0.35]] 

我现在正试图将这些数据与highcharts rose chart示例一起使用,但我正在努力解决这个问题。

任何highchart / json专家都在帮忙吗?

jsfiddle

1 个答案:

答案 0 :(得分:1)

您需要解析数据并将每行返回为简单序列,以获得此图:

series: [{
        data: [0, 0.35, 0, 1.05, 1.05, 0.7, 0.35]
    },{
        data: [0, 0.7, 0, 1.05, 1.74, 1.74, 0],
    }]

http://jsfiddle.net/5ky4g/1/