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 – Unique string id for the object that “owns” the table.
  • key – String key used to disambiguate tables when the owner has more than one.
  • names – Array of string names for each column in the table.
  • columns – Array of value arrays 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 – Unique string id for the object that “owns” the table.
  • key – String key 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.