Kris
Kris

Reputation: 19948

Why is the first label on highcharts bar chart missing?

bar chart

https://jsfiddle.net/rcvwsbdm/

var data = [{"name":"Adult Emergency","y":2},{"name":"Adult Social Care and Health","y":1},{"name":"Anaesthetics","y":1},{"name":"Audiology","y":2}];

var chart_options = {
  "chart":  { "type":"bar", "height":"700" },
  "xAxis":{ "categories":[""] },    
  "series":[{"data": data}]
  };

$('#main').highcharts(chart_options);

jQuery: 2.2.4 Highcharts: 4.4.2

Upvotes: 2

Views: 148

Answers (1)

Grzegorz Blachliński
Grzegorz Blachliński

Reputation: 5222

Right now inside your options.categories you have an empty string:

categories: ['']

This is the reason why you have first label as an empty string. To avoid this situation you can use an empty array instead:

categories: []

Here you can see an example how it can work: https://jsfiddle.net/rcvwsbdm/1/

Best regards.

Upvotes: 3

Related Questions