MCPcopy Index your code
hub / github.com/processing/p5.js / table

Function table

src/io/p5.Table.js:1237–1311  ·  view source on GitHub ↗
(p5, fn)

Source from the content-addressed store, hash-verified

1235};
1236
1237function table(p5, fn){
1238 /**
1239 * Table Options
1240 * Generic class for handling tabular data, typically from a
1241 * CSV, TSV, or other sort of spreadsheet file.
1242 * CSV files are
1243 * <a href="http://en.wikipedia.org/wiki/Comma-separated_values">
1244 * comma separated values</a>, often with the data in quotes. TSV
1245 * files use tabs as separators, and usually don't bother with the
1246 * quotes.
1247 * File names should end with .csv if they're comma separated.
1248 * A rough "spec" for CSV can be found
1249 * <a href="http://tools.ietf.org/html/rfc4180">here</a>.
1250 * To load files, use the <a href="#/p5/loadTable">loadTable</a> method.
1251 * To save tables to your computer, use the <a href="#/p5/save">save</a> method
1252 * or the <a href="#/p5/saveTable">saveTable</a> method.
1253 *
1254 * Possible options include:
1255 * <ul>
1256 * <li>csv - parse the table as comma-separated values
1257 * <li>tsv - parse the table as tab-separated values
1258 * <li>header - this table has a header (title) row
1259 * </ul>
1260 */
1261
1262 /**
1263 * <a href="#/p5.Table">Table</a> objects store data with multiple rows and columns, much
1264 * like in a traditional spreadsheet. Tables can be generated from
1265 * scratch, dynamically, or using data from an existing file.
1266 *
1267 * @class p5.Table
1268 * @deprecated p5.Table will be removed in a future version of p5.js to make way for a new, friendlier version :)
1269 * @param {p5.TableRow[]} [rows] An array of p5.TableRow objects
1270 */
1271 p5.Table = Table;
1272
1273 /**
1274 * An array containing the names of the columns in the table, if the "header" the table is
1275 * loaded with the "header" parameter.
1276 * @deprecated p5.Table will be removed in a future version of p5.js to make way for a new, friendlier version :)
1277 * @type {String[]}
1278 * @property columns
1279 * @for p5.Table
1280 * @name columns
1281 * @example
1282 * let table;
1283 *
1284 * async function setup() {
1285 * // Create a 200x200 canvas
1286 * createCanvas(200, 200);
1287 *
1288 * // Load the CSV file with a header row
1289 * table = await loadTable('assets/mammals.csv', ',', 'header');
1290 *
1291 * // Set text properties for drawing on the canvas
1292 * fill(0); // Set text color to black
1293 * textSize(12); // Adjust text size as needed
1294 *

Callers 3

saveTable.jsFile · 0.85
loadTable.jsFile · 0.85
p5.Table.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected