Reply
Wed 28 Nov, 2012 12:39 pm
var channel_data = [
{
"27th Oct 12": {
"xaxis": "27th Oct 12",
"channels": {
"Create and Craft": {
"views": 13064,
"bandwidth": 623136899214,
"name": "Create and Craft"
},
"5 USA": {
"views": 394,
"bandwidth": 17889861768,
"name": "5 USA"
}
},
"totalViews": 25470,
"totalBandwidth": 923866774348
},
"28th Oct 12": {
"xaxis": "28th Oct 12",
"channels": {
"Create and Craft": {
"views": 15298,
"bandwidth": 860108829822,
"name": "Create and Craft"
},
"5 USA": {
"views": 500,
"bandwidth": 28770314737,
"name": "5 USA"
}
},
"totalViews": 29377,
"totalBandwidth": 1248778079465
}}]
I need to loop through this data and build the following array of objects to use with Highcharts rendering. Categories will be the dates and the data are the views for each date for each channel.
categories: ['27th Oct 12", "28th Oct 12"]
series: [{
name: 'Create and Craft',
data: [13064, 15298]
}, {
name: '5 USA',
data: [394, 500]
}, {
}]