Highcharts Highstock 将 x 轴网格线与数据点中心对齐

Highcharts Highstock align x-axis gridlines with center of data point

我正在使用 Highcharts Highstock 图表来显示每日数据。垂直(x 轴)网格线不与数据点对齐(网格线位于数据点的左侧)。有谁知道如何将网格线与数据点对齐?

http://jsfiddle.net/kngz3exf/3/

Highcharts.setOptions({
    global: {
        useUTC: false
    }
});
$(function () {
    $('#container').highcharts('StockChart', {

        rangeSelector: {
            enabled: false
        },

        yAxis: {
            gridLineWidth: 0
        },

        xAxis: {
            gridLineColor: '#000000',
            gridLineWidth: 1,
            lineColor: '#000000',
            tickColor: '#000000',
            minorGridLineColor: '#000000',
            minorGridLineWidth: 1,
            minorTickColor: '#000000',
            ordinal: true,
            tickInterval: 86400000,
            minorTickInterval: 86400000
        },

        series: [{
            data:[
                [1417410000000, -0.4818850000000001],
                [1417496400000, -0.40866199999999997],
                [1417582800000, 0.20889499999999994],
                [1417669200000, -0.623542],
                [1417755600000, -0.060399999999999995],
                [1418014800000, -0.56108],
                [1418101200000, 0.30852700000000005],
                [1418187600000, -0.4492829999999999],
                [1418274000000, -0.275211],
                [1418360400000, 0.013063999999999965],
                [1418619600000, -0.27293900000000004],
                [1418706000000, 0.49981200000000003],
                [1418792400000, 0.2362090000000001],
                [1418878800000, 0.4464490000000003],
                [1418965200000, 1.2100639999999998],
                [1419224400000, -0.792635],
                [1419310800000, 0.14788899999999994],
                [1419397200000, 0.011684],
                [1419570000000, 0.08526699999999998],
                [1419829200000, -0.12494599999999997],
                [1419915600000, -0.06489100000000003],
                [1420002000000, 0.279632]
            ]
        }]
    });
});

您需要做的是将 useUTC 设置为 false。现在您的 12 月 2 日数据显示在 12 月 2 日轴刻度上。请注意,您的数据不会触及每个主要刻度线 - 看起来您正在跳过周末,但您的轴不是。

通过将我的日期格式从 ticks 更改为 Date.UTC(yyyy, mm, dd),我可以让数据点与垂直网格线对齐。