Highstock datetime xAxis,只能显示全部。没有变焦

Highstock datetime xAxis, can only show all. no zoom

我用 json.

的数据制作了一张高库存图表

我的问题是我只有在完全缩小时才能看到我的数据。 当我放大一周或一个月时,图表中的数据消失了。

我仍然可以在底部的导航器window中看到数据。

JSON:

[
[1475452800000, '10.69'],
[1475193600000, '10.86'],
[1475107200000, '10.69'],
[1475020800000, '10.91']
... (aprox a year)
]

Java:

$.getJSON('_json_stock.php?InfoHistory=<?php echo $G_CompanyStockSymbol;?>', function (data) {

// create the chart data: data,
$('#stockChartHistory').highcharts('StockChart', {
    chart: {
        zoomType: 'x'
    },
    xAxis: {
        type: 'datetime'
    },          
        credits: {
            enabled: false
        },
        exporting: { enabled: false },
    rangeSelector: {
        buttons: [
            {
                type: 'day',
                count: 1,
                text: '1d'
            }, {
                type: 'month',
                count: 1,
                text: '1m'
            },, {
                type: 'month',
                count: 3,
                text: '3m'
            },, {
                type: 'month',
                count: 6,
                text: '6m'
            }, {
                type: 'year',
                count: 1,
                text: '1y'
            }           
        ],
        selected: 2
        },
        series: [{
        name: '<?php echo $G_CompanyStockSymbol;?>',
        data: data,
        tooltip: {
            valueDecimals: 2                
        },          
        threshold: null
        }]
});

});

如果您查看控制台,您会看到 Highcharts 正在输出错误代码 15

Highcharts error #15: www.highcharts.com/errors/15

参考:

Highcharts expects data to be sorted

This happens when you are trying to create a line series or a stock chart where the data is not sorted in ascending X order. For performance reasons, Highcharts does not sort the data, instead it is required that the implementer pre-sorts the data.

如果数据未按 x 值排序,则无法正常工作。在将数据发送到图表之前,您必须对其进行排序。