Highchart specific width stack column bar graph

54,182

Solution 1

Just figured out this myself. pointWidth is the parameter to set the width for bar width. Also the walk around is nice for represent the error bar since there aren't any highly interactive javascript chart support this type of chart yet.

Solution 2

series: [{
            name: strSeriesTitle,
            data: arrData,
            pointWidth: 28
        }]

Solution 3

A working DEMO for setting width of column bars irrespective of the chart size.

You will have to use pointWidth option like:

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },

        plotOptions: {
            series: {
                pointWidth: 40//width of the column bars irrespective of the chart size
            }
        },

        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    });
});

Solution 4

You should use the following options instead of pointWidth to be responsive and not fixed:

plotOptions: {
    series: {
        pointPadding: 0, // Defaults to 0.1
        groupPadding: 0.01 // Defaults to 0.2
    }
},
Share:
54,182
Gäng Tian
Author by

Gäng Tian

Updated on July 10, 2020

Comments

  • Gäng Tian
    Gäng Tian almost 4 years

    Need to find a way to represent a graph with error bar, but it seems that it's not supporting in the highchart at the moment. My plan is to use a stack column bar chart with 0 to lower Y as transparent, and lower Y to upper Y with a red color or whatever I am gonna pick later.

    My question is:

    Is it possible limit the stack column bar width to say 1px regardless the zoom level in highchart?

    Thanks for the input!