Bhagya Bhagya - 5 months ago 27
JSON Question

How to parse json and give to category in highcharts

I am using highcharts and want to parse JSON and assign to categories part

var chartData = {

"chart" :[
{name: "kolkata",categories: ["male", "female"]},
{name: "Mumbai",categories: ["male", "female"]}

]
}


I tired below

var category = [];
var Count = chartData.chart;
for (var i=0; i< Count.length; i++) {
category.push({name : chartData.chart[i].name, categories : chartData.chart[i].categories})

}


finally
xAxis: {

categories: category
}

but its not coming properly on x axis what to do

Answer

For this you need to include library

include following library

<script src="http://blacklabel.github.io/grouped_categories/grouped-categories.js"></script>