Skip to content

Commit 490fe4b

Browse files
authored
fixes
1 parent a3778bf commit 490fe4b

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/io/p5.Table.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -615,30 +615,24 @@ class Table {
615615
* let table;
616616
*
617617
* async function setup() {
618-
* // Create a 300x300 canvas
619618
* createCanvas(300, 300);
619+
* table = await loadTable('/assets/mammals.csv', ',', 'header');
620620
*
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
625621
* table.addColumn('carnivore');
626622
* table.set(0, 'carnivore', 'no');
627623
* table.set(1, 'carnivore', 'yes');
628624
* table.set(2, 'carnivore', 'no');
629625
*
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
633628
*
634-
* // Display the table data on the canvas in a grid format
635-
* // Here we calculate positions based on row and column indices.
636629
* for (let r = 0; r < table.getRowCount(); r++) {
637630
* 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);
642636
* }
643637
* }
644638
*
@@ -987,7 +981,7 @@ class Table {
987981
* @param {Number} value value to assign
988982
*
989983
* @example
990-
* <div class="norender">
984+
* <div>
991985
* <code>
992986
* let table;
993987
*

0 commit comments

Comments
 (0)