score:2

Accepted answer

Looking at the pyramid example, the data must be in the form of a single series with each data point as an array of [name, value]. You have two options, change your PHP to output the correct format or modify the PHP output in javascript. Since you didn't post your PHP code, I'll do the later:

var data = {"success":1,"data":[{"name":"John Spoon","data":300}, {"name":"Dave Jones","data":200},{"name":"Other","data":500}]};    

options.series = [{
    data: $.map(data.data, function(i){ // loop outputted data
        return [[i.name, i.data]]; // coerce into an array of [name,value]
    })
}];

Here's a working example.


Related Articles