Output Charts

Docs · Visuals

Table JSON format.

Rows and columns of text or numbers, with each column formatted its own way.

Try it

Edit the example and the visual redraws. Mistakes show the same messages the API returns.

The visual
Table
Search142
Social88
Referral61
Maps34

Change any number or label. The chart follows.

Fields

The table document
FieldTypeRule
columnsRequiredarray1 to 12 columns, in display order. Each one is described below.
dataRequiredarrayUp to 200 rows. Each row is an object keyed by column key.
Each entry in columns
FieldTypeRule
keyRequiredstringThe row key this column shows. Up to 80 characters.
labelRequiredstringThe column heading. Up to 80 characters; may be empty.
alignRequiredstring"left" or "right". Right suits numbers.
formatRequiredstring"text", "number" or "percent" (0.25 shows as 25%).
statusesOptionalobjectText columns only. 1 to 20 entries mapping a cell's exact text to "good", "warn" or "bad"; the cell gets a dot in that colour and shape. For example, "statuses": { "Up": "good", "Slow": "warn", "Down": "bad" }.
hrefKeyOptionalstringText columns only. Names a row key holding an http or https URL that links this cell; null or an empty string means no link. The key is not shown as a column and must differ from every column key. For example, a column with "hrefKey": "siteUrl" links each cell to that row's siteUrl.
rulesOptionalarrayNumber and percent columns only. 1 to 6 items, each { "below": n, "status": … } or { "atLeast": n, "status": … }, compared with the stored number (0.2 is 20% on a percent column); the first match wins. For example, "rules": [{ "below": 0.9, "status": "bad" }, { "atLeast": 0.99, "status": "good" }].

Good to know

  • A cell is a string of up to 200 characters, a number, or null. A row may leave a column out, which shows an empty cell.
  • A row may hold only column keys and hrefKey keys.
  • Viewers can sort the table by clicking a column heading; it starts in the order you send.

Example

{
  "columns": [
    {
      "key": "channel",
      "label": "Channel",
      "align": "left",
      "format": "text"
    },
    {
      "key": "bookings",
      "label": "Bookings",
      "align": "right",
      "format": "number"
    }
  ],
  "data": [
    { "channel": "Search", "bookings": 142 },
    { "channel": "Social", "bookings": 88 },
    { "channel": "Referral", "bookings": 61 },
    { "channel": "Maps", "bookings": 34 }
  ]
}

Send it from your code

Paste the document in the editor, or replace it with a PUT to the visual's push URL. The push API page has the details and examples.

Next: Markdown note JSON format