JS 拼接字符串数组
1、格式1
1.1例子
[ {name: \'北京\',value: Math.round(Math.random()*1000)}, {name: \'天津\',value: Math.round(Math.random()*1000)}, {name: \'上海\',value: Math.round(Math.random()*1000)} ]
1.2拼接方式
var data = eval("(" + result + ")"); var num1Arr = [];// new Array(); var dataff = {}; for (var i = 0; i < data.length; i++) { if (parseInt(data[i].count1) > 0) { dataff["name"] = data[i].ProvinceName; dataff["value"] = parseInt(data[i].count1); num1Arr.push(dataff); dataff = {}; } }
2、格式2
2.1例子
data: [ [1230771600000, -5.8, 0.1], [1230858000000, -4.1, 1.4], [1230944400000, -0.5, 4.1], [1231030800000, -8.9, -0.7], [1231117200000, -9.7, -3.7], [1231203600000, -3.4, 3.2] ]
2.2拼接方式
var Line_First = new Array(); for (var i = 0; i < dataList.length; i++) { Line_First.push([dataList[i].X_Value, dataList[i].Y_Value,222]); }
3、格式3
3.1例子
[1230771600000, -5.8, 0.1]
3.2 拼接方式
var Line_First = new Array(); for (var i = 0; i < dataList.length; i++) { Line_First.push(dataList[i].X_Value); }