Raza
Raza

Reputation: 2390

Columns HighChart remove spacing for empty data series

Consider the following high chart

enter image description here

At 15 jun, category II has no data, what if I dont want that spacing left for it, Is there anyway to remove such spaces.

for code reference

`http://jsfiddle.net/G5S9L/8/`

Upvotes: 3

Views: 1375

Answers (2)

Mark
Mark

Reputation: 108512

I don't see anything in the API that allows you to do this. As a kludgy workaround you could shift the columns yourself in the onload callback:

, function(chart){
    var barLeft = $(chart.series[0].data[1].graphic.element);
    var barRight = $(chart.series[2].data[1].graphic.element);
    barLeft.attr('x',parseInt(barLeft.attr('x')) + parseInt(barLeft.attr('width'))/2);
    barRight.attr('x',parseInt(barRight.attr('x')) - parseInt(barRight.attr('width'))/2);
});

Updated fiddle.

Upvotes: 3

Raein Hashemi
Raein Hashemi

Reputation: 3384

This is how Highcharts work. It calculates the space for categories, then divide it between series. It doesn't matter if you have data or not, space is given for possible points.

Upvotes: 2

Related Questions