我在jQuery中有类似下面的函数
为3d数组声明范围。这是正确插入的。 平均值是2d阵列。
var ranges = [];
var averages = [];
$.each(data, function(i, item){
alert([item.xAxisTime, item.upperBound, item.lowerBound]);
ranges.push([item.xAxisTime, item.upperBound, item.lowerBound]);
averages.push([item.xAxisTime, item.yAxisValue]);
});
我想产生如下结果
2d数组:
averages = [
[1246406400000, 21.5],
[1246492800000, 22.1],
[1246579200000, 23],
[1246665600000, 23.8]];
3d阵列
ranges = [
[1246406400000, 14.3, 27.7],
[1246492800000, 14.5, 27.8],
[1246579200000, 15.5, 29.6],
[1246665600000, 16.7, 30.7]];
答案 0 :(得分:0)
以下是我获得结果的方式。
var ranges = new Array();
var averages = new Array();
var arrAverage;
var arrRanges;
arrAverage = [item.xAxisTime, item.yAxisValue];
arrRanges = [item.xAxisTime, item.upperBound, item.lowerBound];
averages.push(arrAverage);
ranges.push(arrRanges);