Highcharts:如何消除系列和垂直轴之间的差距?

时间:2017-09-26 11:21:44

标签: highcharts

似乎Highcharts在1.系列线起始/系列线端和2.垂直轴之间添加了一些间距。

有关详细信息,请参阅jsfiddle链接和屏幕截图。

http://jsfiddle.net/8kbf2e1x/

Highcharts.chart('container', {

    title: {
        text: 'Solar Employment Growth by Sector, 2010-2016'
    },

    subtitle: {
        text: 'Source: thesolarfoundation.com'
    },

        xAxis: {
            categories: ['D1', 'D2', 'D3', 'D4']
    },

    yAxis: {
        title: {
            text: 'Number of Employees'
        }
    },
    legend: {
        layout: 'vertical',
        verticalAlign: 'bottom'
    },

    plotOptions: {
        series: {
        }
    },

    series: [{
        name: 'Installation',
        data: [43934, 52503, 57177, 69658]
    }, {
        name: 'Manufacturing',
        data: [24916, 24064, 29742, 29851]
    }, {
        name: 'Sales & Distribution',
        data: [11744, 17722, 16005, 19771]
    }, {
        name: 'Project Development',
        data: [null, null, 7988, 12169]
    }, {
        name: 'Other',
        data: [12908, 5948, 8105, 11248]
    }],

    responsive: {
        rules: [{
            condition: {
                maxWidth: 500
            },
            chartOptions: {
                legend: {
                    layout: 'horizontal',
                    align: 'center',
                    verticalAlign: 'bottom'
                }
            }
        }]
    }

});

Highcharts - auto added gaps

如何摆脱这个空间?我希望我的系列线从绘图区域内的ened扩展到最终,没有间隙。数据点数量较少是否可以实现? (例如在我的情况下,每个系列只有4个数据点)

1 个答案:

答案 0 :(得分:4)

检查pointPlacement

当pointPlacement为" on"时,该点不会创建X轴的任何填充。

 plotOptions: {
  series: {
    pointPlacement: 'on'
  }
},

Fiddle演示