1

在绘制值等于该yAxis.min值的折线图时,该线隐藏在 X 轴下方。

我将 Y 轴最小值设置为 0,并且数据集包含零

这是一个例子:

$(function () {
        $('#container').highcharts({
            xAxis: {
                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
            },
            yAxis: {
                min: 0,
                max: 100
            },
            series: [{
                name: 'Tokyo',
                data: [7.0, 6.9, 0, 0, 0, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
            }]
        });
    });

http://jsfiddle.net/egQH8/1/

如果我将值增加到 0.2,您可以看到该行开始出现:http: //jsfiddle.net/2RCdV/1/

我能做些什么来解决这个问题吗?

4

2 回答 2

4

删除min: 0并添加startOnTick: false.

这将使 Highcharts 自动计算最小值,并且由于它不再从刻度线开始,它将在 xAxis 上方仅几个像素处绘制 0 yAxis 线。

看到它在这里运行。

于 2013-07-09T09:00:47.523 回答
0

我们为 4px 行修复了这个问题:

// This fixes the "thin lines at top & bottom of chart" bug
Highcharts.wrap(Highcharts.Chart.prototype, 'setChartSize', function (proceed) {
    proceed.apply(this, [].slice.call(arguments, 1));
  if (includes(['line','spline'], get(this, 'options.chart.type'))) {
    this.clipBox.height += 6;
    this.clipBox.y -= 3;
  }
});
于 2017-05-28T01:22:30.183 回答