Highcharts - 网格线高度

Highcharts - Grid line height

我希望 highchart 的网格线只显示到图表高度的 75%,而图表的其余部分不应显示网格线。有没有办法设置网格线的高度?

xAxis: {               
    gridLineWidth: 1,               
    gridLineDashStyle: 'longdash',
    gridLineColor: '#B3BABB',
}

通常不支持,但简单的更改将允许您:http://jsfiddle.net/ngk6vtbh/

(function(H) {
    H.wrap(H.Tick.prototype, 'render', function(p, index, old, opacity) {
        var tick = this,
            d,
            size = 0.25; // = 75%, 0.5 = 50%, 0.75 = 25% etc.
        p.call(this, index, old, opacity);

        if(tick.gridLine && this.axis.isXAxis) {

            d = tick.gridLine.d.split(' '); // get default path

            d[2] = ( d[5] - d[2] ) * size + tick.axis.chart.plotTop; // modify path - don't forget about plotTop

            tick.gridLine.attr({
                d: d // apply new path
            });
        }

    });
})(Highcharts)