@@ -615,30 +615,24 @@ class Table {
615
615
* let table;
616
616
*
617
617
* async function setup() {
618
- * // Create a 300x300 canvas
619
618
* createCanvas(300, 300);
619
+ * table = await loadTable('/assets/mammals.csv', ',', 'header');
620
620
*
621
- * // Load the CSV file with a header row
622
- * table = await loadTable('assets/mammals.csv', ',', 'header');
623
- *
624
- * // Add a new column 'carnivore' and set its values
625
621
* table.addColumn('carnivore');
626
622
* table.set(0, 'carnivore', 'no');
627
623
* table.set(1, 'carnivore', 'yes');
628
624
* table.set(2, 'carnivore', 'no');
629
625
*
630
- * // Set text properties for drawing on the canvas
631
- * fill(0); // Text color: black
632
- * textSize(12); // Adjust text size as needed
626
+ * fill(0); // Set text color to black
627
+ * textSize(11); // Adjust text size as needed
633
628
*
634
- * // Display the table data on the canvas in a grid format
635
- * // Here we calculate positions based on row and column indices.
636
629
* for (let r = 0; r < table.getRowCount(); r++) {
637
630
* for (let c = 0; c < table.getColumnCount(); c++) {
638
- * // Calculate x and y positions for each cell.
639
- * let x = c * 50 + 10; // Horizontal offset for each column
640
- * let y = r * 30 + 20; // Vertical offset for each row
641
- * text(table.getString(r, c), x + c*25, y);
631
+ * // Keep column spacing consistent (e.g. 80 pixels apart).
632
+ * let x = c * 80 + 10;
633
+ * let y = r * 30 + 20;
634
+ * // Use x directly, rather than multiplying by c again
635
+ * text(table.getString(r, c), x, y);
642
636
* }
643
637
* }
644
638
*
@@ -987,7 +981,7 @@ class Table {
987
981
* @param {Number } value value to assign
988
982
*
989
983
* @example
990
- * <div class="norender" >
984
+ * <div>
991
985
* <code>
992
986
* let table;
993
987
*
0 commit comments