xxxxxxxxxx
33
let table;
let spacing;
function preload() {
// Load CSV file into a Table object
// "header" option indicates the file has a header row
table = loadTable("assets/multiTimeline.csv", "csv");
}
function setup() {
createCanvas(640, 480);
// spacing is rowcount - 3 since the first three rows are superfluous
spacing = width / (table.getRowCount() - 3);
}
function draw() {
background(255);
// You can access iterate over all the rows in a table
// start at row 3 since the first few rows are filler
// scaffolding
for (let i = 3; i < table.getRowCount(); i++) {
let row = table.getRow(i);
// You can access the fields via their column name (or index)
let string = row.getString(0);
// interest in topic: range 0 - 100
let interest = row.getNum(1);
print(string + ": " + interest);
}
}