I've got several items I'm trying to display within a canvas
. I've json
my php
data to support doing this in javascript
.
Now I'm trying to iterate the database
names with a for
loop so I don't have to write the code for each.
Here's what I've got so far:
for ((var i=2; i<=17; i++) && (var j=3; i<=18; j++)){
if((row.g1c[j]y + row.g1c[j]m != 0) && ((12*row.g1c[j]y + row.g1c[j]m) > (360 + (12*row.O1y + row.O1m)))){
var g1c[i]w = (360-(12*row.g1c[i]y + row.g1c[i]m)-(12*row.O1y + row.O1m));
} else if (row.g1c[j]y +row.g1c[j]m != 0){
var g1c[i]w = ((12*row.g1c[j]y + row.g1c[j]m)-(12*row.g1c[i]y + row.g1c[i]m));
} else {}
var g1c[i]x = ((12*row.g1c[i]y + row.g1c[i]m)-(12*row.O1y + row.O1m));
var lineHeight = 15;
var maxWidth = 2.5*(g1c[i]w);
var x = 80+(2.5*(g1c[i]x))+(maxWidth/2);
}
This isn't working and I'm 99.999% sure it has to do with the i and j syntax, but everything I've looked up and tried hasn't worked.
If someone would tell me where my screw-up is, I'd be eternally grateful.
Thanks in advance!