@@ -486,33 +486,27 @@ function files(p5, fn){
486
486
* @example
487
487
* <div class='norender'>
488
488
* <code>
489
- * // Given the following CSV file called "mammals.csv"
490
- * // located in the project's "assets" folder:
491
- * //
492
- * // id,species,name
493
- * // 0,Capra hircus,Goat
494
- * // 1,Panthera pardus,Leopard
495
- * // 2,Equus zebra,Zebra
496
- *
497
489
* let table;
498
490
*
499
491
* async function setup() {
500
- * table = await loadTable('assets/mammals.csv', 'csv', 'header');
501
- *
502
- * //count the columns
503
- * print(table.getRowCount() + ' total rows in table');
504
- * print(table.getColumnCount() + ' total columns in table');
505
- *
506
- * print(table.getColumn('name'));
507
- * //["Goat", "Leopard", "Zebra"]
508
- *
509
- * //cycle through the table
510
- * for (let r = 0; r < table.getRowCount(); r++)
511
- * for (let c = 0; c < table.getColumnCount(); c++) {
512
- * print(table.getString(r, c));
513
- * }
514
- * describe(`randomly generated text from a file,
515
- * for example "i smell like butter"`);
492
+ * // Create a 200x200 canvas
493
+ * createCanvas(200, 200);
494
+ *
495
+ * // Load the CSV file with a header row
496
+ * table = await loadTable('assets/mammals.csv', ',', 'header');
497
+ *
498
+ * // Get the second row (index 1)
499
+ * let row = table.getRow(1);
500
+ *
501
+ * // Set text properties
502
+ * fill(0); // Set text color to black
503
+ * textSize(16); // Adjust text size as needed
504
+ *
505
+ * // Display each column value in the row on the canvas.
506
+ * // Using an offset for y-position so each value appears on a new line.
507
+ * for (let c = 0; c < table.getColumnCount(); c++) {
508
+ * text(row.getString(c), 10, 30 + c * 20);
509
+ * }
516
510
* }
517
511
* </code>
518
512
* </div>
0 commit comments