javascript - for loop within d3.json -


d3.json working fine till included loop in it. populating patientlist object list of patient names, each patient have array of appointment dates , alpha beta values. database stores multiple rows each patient name , alpha beta values remain same dates vary. therefore, loop sort out info name primary key.but have no idea what's wrong in here it's first time working d3 , js.

var data; var patientlist = {};  d3.json("data.php", function(error, json)  {        if (error) return console.warn(error);     data = json;         for(var = 0; < data.length; i++)  {         var name = data[i].name;          if(!patientlist[name])  {          var newpatient = {             dates: data[i].date,             alpha: data[i].alpha,             beta; data[i].beta         };          patientlist[name] = newpatient;          } else  {          patientlist[name].dates.push(data[i].date);         }     }     alert("hello," + data[3].name); }); 

any suggestions ??

thanks in advance!

maybe it's typo in

beta; data[i].beta 

which should be

beta: data[i].beta 

what console.log say?


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -