Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/`
like image 742
Raza Avatar asked Apr 02 '26 00:04

Raza


1 Answers

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.

like image 56
Mark Avatar answered Apr 03 '26 14:04

Mark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!