toyplot/tables module

The toyplot/tables module can be used to store tabular data for later retrieval.

toyplot/tables.set(owner, key, names, columns)

Store tabular information, identified by owner and key, for later retrieval. For example:

context.require(
    dependencies=["toyplot/tables"],
    arguments=[mark_id, column_names, columns],
    code="""function(tables, mark_id, column_names, columns)
    {
        tables.store(mark_id, "vertex_data", column_names, columns);
    }""")
Arguments:
  • owner (string) – Unique id for the object that “owns” the table.
  • key (string) – Used to disambiguate tables when the owner has more than one.
  • names (array) – Names for each column in the table.
  • columns (array) – Array of values for eacn column in the table.
toyplot/tables.get(owner, key)

Retrieve a table stored previously using toyplot/tables.set(). For example:

context.require(
    dependencies=["toyplot/tables"],
    arguments=[graph_id],
    code="""function(tables, graph_id)
    {
        console.log(tables.get(graph_id, "vertex_data"));
    }""")
Arguments:
  • owner (string) – Unique id for the object that “owns” the table.
  • key (string) – Used to disambiguate tables when the owner has more than one.
Returns:

object containing names and columns arrays, containing the

table column names and column values, respectively.