Highcharts json 与 coinbase

Highcharts json with coinbase

我想制作一个 coinbase 图表:

$.getJSON("Getprice.php",   {},   function(data) {
        Price = data[1]['date'];

        $("#result").html(data[1]['date']);
        alert(Price);



    $('#container').highcharts({

        title: {
            text: 'July temperatures',
            type: 'datetime'
        },

        xAxis: {
            type: 'datetime'
        },

        yAxis: {
            title: {
                text: null
            }
        },

        tooltip: {
            crosshairs: true,
            shared: true,
            valueSuffix: '°C'
        },

        legend: {
        },

        series: [{
            name: 'Date',
            data: Price,
            zIndex: 1,
            marker: {
                fillColor: 'white',
                lineWidth: 2,
                lineColor: Highcharts.getOptions().colors[0]
            }
        }, {
            name: 'Range',
            data: data[2],
            type: 'arearange',
            lineWidth: 0,
            linkedTo: ':previous',
            color: Highcharts.getOptions().colors[0],
            fillOpacity: 0.3,
            zIndex: 0
        }]
    });
});

图表无法显示这里是 coinbase url: https://www.coinbase.com/charts/price_history?days=365 我在 Getprice.php curl 和 header json 中使用只是为了获取页面

一些线索

  • 你的数据应该是JSON
  • 日期字段名称应为 x,时间应为时间戳(时间以毫秒为单位)
  • 值的名称应为 y