xxxxxxxxxx
47
let table;
function preload() { //it makes sure that everythings checks out before the other functions execute
table = loadTable('information.csv', 'csv', 'header');
}
function setup() {
createCanvas(400, 400);
noLoop();
}
function draw() {
background(255,200,204);
//this makes sure there is content in the data
if (table) {
//get the amount of rows in the CSV
let numRows = table.getRowCount();
//get the column titled age and how_tall
let age = table.getColumn('age');
let how_tall = table.getColumn("how_tall");
//iterate over the number of rows
for (let i = 0; i < numRows; i++) {
noStroke()
let x = 100;
let y = 100+(i*25); //i*25 will increment by 20 each time the loop runs
let w = age[i]*5; //age by itself was small, so * to get bigger
let h = 10;
if (name[i] =='dana'){
h=5;
}
rect(x,y,w,h);
}
}
}