Maximum bar width in Highcharts column charts

后端 未结 8 1689
梦毁少年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:45

    function(chart){
            var series = chart.series[0];
            //--- Enforce a Maximum bar width
            if (series && series.data.length) {
                if (series.data[0].pointWidth  >  MaximumBarWidth) {
                    for(var i=0;i< chart.series.length;i++)
                      chart.series[i].update({
                        pointWidth:MaximumBarWidth
                        });
                }
            }
        }
    

    http://jsfiddle.net/pXZRV/40/

提交回复
热议问题