var yData = [];//Y轴数据
var xData = [];//X轴数据
$(data.rows).each(function(i){
var obj = data.rows[i];
// alert(obj.key);
// alert(obj.value);
yData.push(obj.key); //动态取值
xData.push(obj.value); //动态取值
});
由于JS不能直接遍历Map,但是可以遍历JSON对象,所以先将Map转为JSON数据,再由JS去解析遍历JSON对象,就达到了间接遍历Map的目的:
var proIdArray = new Array();
var proNameArray = new Array();
// Deal with the project names.
var theProjectsObj = JSON.parse(result.data["projectIdsNames"]);
for (var proId in theProjectsObj) {
proNameArray.push(theProjectsObj[proId]);
proIdArray.push(proId);
}