日期:2014-05-16  浏览次数:20509 次

highcharts中的json数据转换问题请教

比如我从php获取了json数据如下:


data = {"Firefox":45,"IE":26.8,"Chrome":{"name":"chrome","y":28.2,"sliced":true},"Safari":8.5,"Opera":6.2,"Others":0.7}



但他series中的data数据如下:

            series: [{
                type: 'pie',
                name: 'Browser share',
                data: [
                    ['Firefox',   45.0],
                    ['IE',       26.8],
                    {
                        name: 'Chrome',
                        y: 12.8,
                        sliced: true,
                        selected: true
                    },
                    ['Safari',    8.5],
                    ['Opera',     6.2],
                    ['Others',   0.7]
                ]
            }]


我怎么将上面的data转换成下面的data