如何在Highcharts中使用特殊输入格式?

时间:2015-09-07 10:47:43

标签: highcharts

我有一个输入,您可以在下面看到:

{
    "Data": [{
        "Time": "00:00:00",
        "Value": 2959.927000
    }, {
        "Time": "00:15:00",
        "Value": 2959.927000
    }, {
        "Time": "00:30:00",
        "Value": 2959.927000
    }, {
        "Time": "00:45:00",
        "Value": 2959.927000
    }, {
        "Time": "01:00:00",
        "Value": 2959.927000
    }, {
        "Time": "01:15:00",
        "Value": 2959.927000
    }]
}

我想展示它,我该怎么办?

1 个答案:

答案 0 :(得分:0)

您可以使用在http://karanbalkar.com/2014/06/populate-highcharts-with-json-data-using-jquery/找到的脚本,然后只修改填充该系列的部分:

// Populate series
for (i = 0; i < data.student_data.length; i++) {
    processed_json.push({
        name: data.student_data[i].key,
        y: parseInt(data.student_data[i].value)
    });
}

然后,将xAxis类型设置为category:

xAxis: {
    type: 'category'
}