xxxxxxxxxx
43
let data;
function preload() {
//data = loadTable(url, 'csv', 'header');
data = loadTable('2018B.csv', 'csv', 'header');
}
function setup() {
createCanvas(500, 1000);
noLoop();
}
function draw() {
background(20);
//this makes sure there is content in the data
if (data) {
//get the amount of rows in the CSV
let numRows = data.getRowCount();
//get the column titled Miles
let rating = data.getColumn('My Rating');
let title = data.getColumn("Title");
//debug
print(rating);
print(title);
//iterate over the number of rows
for (let i = 0; i < numRows; i++) {
let x = 100;
let y = 100+(i*15); //i*20 will increment by 20 each time the loop runs
let w = rating[i]*20; //rating by itself was small, so * to get a bigger #
let h = 10;
fill("red");
rect(x,y,w,h);
}
}
}