使用jquery将[[xaxis,yaxis]]数据传递给highchart系列

时间:2011-08-12 13:14:52

标签: highcharts

我需要以下面的格式将数据传递给Highchart系列

series: [{ name: 'Deployment Latency', data: [[Date.UTC(2011, 6, 27, 01, 30), 6.76],
[Date.UTC(2011, 6, 27, 07, 30), 6.24],
[Date.UTC(2011, 6, 27, 13, 30), 6.45],
[Date.UTC(2011, 6, 27, 20, 30), 7.76],
[Date.UTC(2011, 6, 28, 01, 30), 6.76],
[Date.UTC(2011, 6, 28, 07, 30), 5.76],
[Date.UTC(2011, 6, 28, 13, 30), 6.20],
[Date.UTC(2011, 6, 28, 20, 30), 6.12],
[Date.UTC(2011, 6, 29, 01, 30), 6.41],
[Date.UTC(2011, 6, 29, 07, 30), 5.99],
[Date.UTC(2011, 6, 29, 13, 30), 6.25]]

我应该如何使用jquery继续传递数据。 xaxis是DataTime& y轴是双倍的。请指导我

1 个答案:

答案 0 :(得分:0)

由于您拥有的数据已经是Datey值的数组,因此您应该没有任何问题。 As stated in the documentation,在许多其他问题中,highcharts可以接受不同格式的数据。

在您的情况下,您只需将其传递到图表中,就像其他任何图表一样。

var your_data = {}; // assuming that the data you've listed is an object as described in your question.

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