I have the following data:
var data = {"categories":["GLA Age: 65+"],"series":[{"name":"Hendon","data":[11.98]},{"name":"High Barnet","data":[17.86]},{"name":"Mill Hill","data":[13.73]},{"name":"Oakleigh","data":[17.42]},{"name":"Totteridge","data":[17.76]}]};
I need the 'names' to be the categories names so I'm using 'events > load' to apply this to the highcharts code:
var seriesData = this.series;
var tCategories = [];
for (i = 0; i < seriesData.length; i++) {
tCategories.push(seriesData[i].name);
}
this.xAxis[0].setCategories(tCategories);
Then I need to set the 'data' into one array like
[11.98, 17.86, 13.73, 17.42, 17.76]
The problem I've come across is that the first lot of data shows in the first bar:
example here: http://jsfiddle.net/zidski/13rexxyo/3/
The code to create the new array ([11.98, 17.86, 13.73, 17.42, 17.76])
var arrayofArrays = data.series.map(function (item) {
return JSON.stringify([item.data]);
});
var seriesString = arrayofArrays;
seriesString = seriesString;
var n = JSON.stringify(seriesString).replace(/\[|]|"/g, '');
var g = '[' + n + ']';
var h = JSON.stringify(g);
var seriesC = JSON && JSON.parse(g) || $.parseJSON(g);
this.series[0].setData(seriesC);
