Skip to content Skip to sidebar Skip to footer

How To Parse Json Into Highcharts

The following: $.get('/api/ajax_prices/' + product +'/', afterEndexPricesLoaded) Returns a json object {'aaData': [ [1, '70.1700', '2008-12-29 11:23:00'], [2, '70.2600

Solution 1:

Is this what you're looking for?

http://jsfiddle.net/TWF6N/349/

$(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 [ newDate(row[2]).getTime(), parseInt(row[1]) ];
    });
    console.log(newData);

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

Post a Comment for "How To Parse Json Into Highcharts"