Highchart没有显示行

时间:2015-02-04 03:46:40

标签: javascript highcharts

我有一个关于highstock(highchart)的问题,因为你可以看到2个数据之间的线没有显示,但是数据在那里。
enter image description here

enter image description here

JS:

$(function () {
Highcharts.setOptions({
});
// create the chart when all data is loaded
createChart = function (seriesOptions) {

    $('#dashboardDetailNoa').highcharts('StockChart', {

        series: seriesOptions
    });
};

$.getJSON(BASE_URL + '/dashboard/ajaxchart/chart', function (data) {
    createChart(data);
});
});

JSON返回值

    [{
    "name": "AX",
    "color": "#92489d",
    "data": [[1421686800000,
    10]]
},
{
    "name": "BY",
    "color": "#ad76b6",
    "data": [[1421686800000,
    0]]
},
{
    "name": "AX",
    "color": "#92489d",
    "data": [[1421773200000,
    1]]
},
{
    "name": "BY",
    "color": "#ad76b6",
    "data": [[1421773200000,
    0]]
},
{
    "name": "AX",
    "color": "#92489d",
    "data": [[1421859600000,
    1]]
},
{
    "name": "BY",
    "color": "#ad76b6",
    "data": [[1421859600000,
    0]]
},
{
    "name": "AX",
    "color": "#92489d",
    "data": [[1421946000000,
    1]]
},
{
    "name": "BY",
    "color": "#ad76b6",
    "data": [[1421946000000,
    0]]
}]

这是我在我的页面加载的javascript

jquery-2.1.1.min.js
bootstrap.min.js
highstock.js
myChart.js

任何人都可以告诉我我必须做什么?我不知道我的代码有什么问题。

THX

1 个答案:

答案 0 :(得分:0)

我已经找到了答案。问题是JSON

正确的JSON结构就像这样

[{
    "name": "AX",
    "color": null,
    "data": [
    [1420045200000,1001],
    [1420131600000,1002],
    [1420218000000,1003],
    ]
},
...........
]