Skip to content
jwildfire edited this page Sep 29, 2017 · 8 revisions

table

object

The table object represents a simple table rendered as, you guessed it, a <table> element with a <thead> and <tbody>. Such a table is useful for creating listings of raw data associated with a chart or certain of its marks (for instance, clicking a bar in a bar chart renders a table of those values represented in that bar).

table.init(data)

Binds data to the table object that was created using webCharts.createTable() and then renders the table using the methods described below.

Param Type Default Description
data Array none raw data following the typical d3.csv() formatting convention to be consumed by later table functions

table.layout()

sets up an empty <table> element with an empty <thead> element that will house the appropriate <tbody> and <tr>s when data is provided to the table

table.draw(data)

renders the table; if no arguments are passed, the table is drawn using the same data it was initialized with; if data is provided, this data is put through the appropriate transformations and then used to render the table

Param Type Default Description
data Array table.raw_data raw data to be consumed by later table functions

table.destroy()

Removes all components of the table from the DOM, and triggers the destroy callback method. Added in version 1.7.0

table.data

object

Once the table is initialized, several data objects are bound to the table object. These include:

  • table.data.raw - all data rows passed to the table in table.init()
  • table.data.filtered - table.data.raw with filters applied (if any)
  • table.data.searched - table.data.filtered with search applied (if any)
Clone this wiki locally