Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/457.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将json解析为highcharts_Javascript_Json_Highcharts - Fatal编程技术网

Javascript 如何将json解析为highcharts

Javascript 如何将json解析为highcharts,javascript,json,highcharts,Javascript,Json,Highcharts,以下是: $.get('/api/ajax_prices/' + product +'/', afterEndexPricesLoaded) 返回一个json对象 {"aaData": [ [1, "70.1700", "2008-12-29 11:23:00"], [2, "70.2600", "2008-12-29 16:22:00"], [3, "70.6500", "2008-12-30 11:30:00"], [4, "70.8700", "2008-

以下是:

$.get('/api/ajax_prices/' + product +'/', afterEndexPricesLoaded)
返回一个json对象

{"aaData": [
    [1, "70.1700", "2008-12-29 11:23:00"],
    [2, "70.2600", "2008-12-29 16:22:00"],
    [3, "70.6500", "2008-12-30 11:30:00"],
    [4, "70.8700", "2008-12-30 16:10:00"],
    [5, "70.5500", "2009-01-02 11:09:00"],
    [6, "70.6400", "2009-01-02 16:15:00"]
]}
我正在尝试将json字符串解析为highchart

这是我正在尝试使用的代码(data=上面的json字符串):

如何将数据导入highchart系列

编辑

图形类型=

示例=

这就是您要找的吗


这是一个JavaScript对象文本,而不是JSON字符串。你到底想用哪一个?为什么要把它标记为Python?我在这里没有看到任何Python。糟糕的是,我正在使用Python/django。我删除了标记这是哪种图形类型?链接plsalmest。。。。。。我不需要时间。我需要年、月、日,如下日期。UTC(Y、D、M)
function afterPricesLoaded(data, textStatus, xhr) {

    var options = {
        chart: {
            renderTo: 'graph'
        },
        title: {
            text: 'Some text',
            style: {
                color: '#888888'
            }
        },
        xAxis: {
            type: 'datetime'
        }
        /*
        series: [{

            data: [
                [Date.UTC(2011, 0, 0), 29.9],
                [Date.UTC(2012, 0, 0), 71.5],
                [Date.UTC(2013, 0, 0), 106.4]
            ]}
        ]*/
    };

    new Highcharts.Chart(options)
}
$(function () {

    data = {"aaData": [
        [1, "70.1700", "2008-12-29 11:23:00"],
        [2, "70.2600", "2008-12-29 16:22:00"],
        [3, "70.6500", "2008-12-30 11:30:00"],
        [4, "70.8700", "2008-12-30 16:10:00"],
        [5, "70.5500", "2009-01-02 11:09:00"],
        [6, "70.6400", "2009-01-02 16:15:00"]
    ]};

    newData = data.aaData.map( function(row) {
        return [ new Date(row[2]).getTime(), parseInt(row[1]) ];
    });
    console.log(newData);

    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container'
        },
        xAxis: {
            type: 'datetime'
        },
        series: [{
            data: newData
        }]
    });
});