Reduce gap between series data in Bar Highchart

Aditya Sethi picture Aditya Sethi · Nov 12, 2013 · Viewed 25.7k times · Source

I want to reduce space between bar chart series data. Below mentioned is the image which gives a clear picture :

enter image description here

Can anyone suggest the best approach to do it?

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        title: {
            text: 'Historic World Population by Region'
        },
        subtitle: {
            text: 'Source: Wikipedia.org'
        },
        xAxis: {
            categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
            title: {
                text: null
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Population (millions)',
                align: 'high'
            },
            labels: {
                overflow: 'justify'
            }
        },
        tooltip: {
            valueSuffix: ' millions'
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true
                }
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'top',
            x: -40,
            y: 100,
            floating: true,
            borderWidth: 1,
            backgroundColor: '#FFFFFF',
            shadow: true
        },
        credits: {
            enabled: false
        },
        series: [{
            name: 'Year 1800',
            data: [107, 31, 635],
            pointWidth: 22,
        }, {
            name: 'Year 1900',
            data: [133, 156, 947],
            pointWidth: 22
        }]

    });
});

http://jsfiddle.net/fMdk3/5/

Answer

SteveP picture SteveP · Nov 12, 2013

The options you want to play with are pointPadding (padding between bars) and groupPadding (padding between seies).

e.g.

 plotOptions: {
        series: {
            pointPadding: 0,
            groupPadding: 0.1,
        }
    },

e.g. http://jsfiddle.net/BZzWQ/