X-axis category name from a row in a series list

Is it possible to get x axis names from a string in my series list? I am building this list of series on the backend and would like to use New York, Los Angeles and Chicago as X-axis category values.

I would expect New York, Los Angeles and Chicago to become X axis labels, however I get from -0.25 to 2.25.

Thanks.

http://jsfiddle.net/nicholasduffy/H7zgb/2/

$(function () { var chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, plotOptions: { column: { stacking: 'normal', dataLabels: { enabled: false } } }, series: [{ "data": [ ["New York", 3570.5], ["LA", 50128.38], ["Chicago", 5281.22] ], "name": "Stuff" }, { "data": [ ["New York", 10140.84], ["LA", 21445.04], ["Chicago", 12957.77] ], "name": "Junk" }, { "data": [ ["New York", 65119.6], ["LA", 103118.6], ["Chicago", 78349.6] ], "name": "Other Stuff" }] }); 

});

+6
source share
2 answers

As with HighCharts 3, you can use xAxis.type and set it to a “category” for your desired behavior without specifying category names.

http://api.highcharts.com/highcharts#xAxis.type

I edited jFiddle to have the following:

 xAxis: { type: "category" } 

http://jsfiddle.net/H7zgb/22/

+14
source

I believe that you are looking for this ...

http://api.highcharts.com/highcharts#xAxis.categories

Take a look at this fiddle ... I added the following:

  xAxis: { categories: ["New York", "LA", "Chicago"] }, 

http://jsfiddle.net/H7zgb/3/

+1
source

All Articles