Bhagya Bhagya - 2 years ago 145
JSON Question

Parse json and give to category in Highcharts

I am using Highcharts and want to parse JSON and assign to categories part.

This is my chart data:

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

I tried this:

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})


xAxis: {
categories: category

The category not coming properly on x axis. Does anybody have an idea why it's not?

Answer Source

For this you need to include library

include following library

<script src=""></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download