xxxxxxxxxx
27
let table;
let numOfRow, numOfCol;
let link="https://p5js.org/reference/#/p5.Table"
function preload() {
table = loadTable('assets/sample.csv', 'csv','header');
}
function setup() {
createCanvas(800, 500);
numOfRow = table.getRowCount();
numOfCol = table.getColumnCount();
print(link);
print(table.getColumn('year'));
}
function draw() {
background(220);
text('There are ' + numOfRow + ' rows in the table.', 100, 10);
text('There are ' + numOfCol + ' columns in the table.', 100, 20);
for (let j = 0; j < numOfRow; j++)
for (let i = 0; i < numOfCol; i++) {
//print(i, j, table.get(j, i));
text(table.get(j, i), i * 60, 40 + j * 20);
}
}