Maximum bar width in Highcharts column charts

后端 未结 8 1655
梦毁少年i
梦毁少年i 2021-02-18 14:20

I\'m using Highcharts to create some vertical bars (a.k.a. \"column charts\") a lot like here: highcharts.com/demo/column-basic

Thing is, sometimes there are 30 bars in

8条回答
  •  一向
    一向 (楼主)
    2021-02-18 14:53

    Obviously this question was asked a long time ago when this feature didn't exist, but as of Highcharts 4.1.8 you can do this without any workarounds using the plotOptions.column.maxPointWidth setting:

    $('#container').highcharts({
        /* Other chart settings here... */
        plotOptions: {
            column: {
                /* Here is the setting to limit the maximum column width. */
                maxPointWidth: 50
            }
        }
        /* Other chart settings here... */
    });
    

    Below is the JSFiddle of the basic column chart example, modified to show this working:

    http://jsfiddle.net/vu3dubhb/

    And the documentation for this setting is here: http://api.highcharts.com/highcharts#plotOptions.column.maxPointWidth

提交回复
热议问题