How can I do in Highchart to have 1px space between the columns and the y axis?

I need to make a column chart using tall charts having 1px space between the columns and the Y axis, how can I add the 1px space that is in my desired chart to the chart I made is the code I made: (Sorry I don’t have enough reputation to add images that why not post).

var data = [ 20, 29, 25, 29, 21, 17, 20, 19, 18]; 
createMeasuresGraph(data, "quintals-sugar-graph");
function createMeasuresGraph(data, container) {
    data[0] = { color: '#55B647', y: data[0] };
    data[data.length -2 ] = { color: '#F15B49', y: data[data.length -2 ] };
    var chart = new Highcharts.Chart({
        chart: {
            marginBottom: 1,
            marginLeft: 0,
            marginRight: 0,
            marginTop: 0,
            renderTo: container,
            type: 'column',
        },
        credits: {
            enabled: false
        },
        legend: {
            enabled: false
        },
        plotOptions: {
            column: {
                pointWidth: 5,
            },
            series: {
                borderWidth: .1,

            }
        },
        series: [{
            data: data,
            color: '#95D2F3',
            shadow: false,
        }],
        title: {
            text: ''
        },
        tooltip: {
            enabled: false
        },
        xAxis: {
            labels: {
                enabled: false
            },
            title: {
                enabled: false
            },
            lineColor: '#CBCBCB',
            tickWidth: 0
        },
        yAxis: {
            endOnTick: false,
            gridLineWidth: 0,
            labels: {
                enabled: false
            },
            startOnTick: false,
            minPadding: 0.5,
            title: {
                text: ""
            }
        }
    });
}

I also see that the space between them is not the same in all columns, maybe I'm using the wrong aproch to get spaces, what would it be better?

+5
source share
3 answers

Do you need 1px space between each column?

/ :

var colWidth = ($('#quintals-sugar-graph').width() / data.length) + 1;

borderWidth 1px, :

    plotOptions: {
        column: {
            pointWidth: colWidth,
            borderWidth: 1
        },

    },

Fiddle .

enter image description here

+13

1px? , :

plotOptions: {
    column: {
        pointPadding: 0,
        groupPadding: 0
    }
}
+4

You can simply do:

plotOptions: {
  column: {
    pointPadding: 0,
    groupPadding: 0,
    borderWidth: 1
  }
},
+2
source

All Articles