Output Charts

Docs · Visuals

Heatmap JSON format.

Values coloured from light to dark: any two categories, such as weekday by hour, or one cell per day, a year at a glance.

Try it

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

The visual
Heatmap
Mon, 07: 1.4 kWhMon, 08: 0.9 kWh

Change any number or label. The chart follows.

Fields

The heatmap document
FieldTypeRule
layoutRequiredstringgrid (two categories, x across and y down) or calendar (one cell per day, weeks across). The layout decides which keys the document takes: a grid has xKey and yKey and no dateKey, a calendar has dateKey and no xKey or yKey.
xKeyOptionalstringGrid only, and required there. The key in each row that holds the column's label. Up to 80 characters. Must differ from yKey and valueKey.
yKeyOptionalstringGrid only, and required there. The key in each row that holds the row's label. Up to 80 characters. Must differ from xKey and valueKey.
dateKeyOptionalstringCalendar only, and required there. The key in each row that holds the day, written YYYY-MM-DD. Up to 80 characters. Must differ from valueKey.
valueKeyRequiredstringThe key in each row that holds the number the colour shows. Up to 80 characters. Must differ from the layout's other keys.
formatOptionalstringnumber (the default), compact or percent. A percent value is a fraction: 0.25 shows as 25%.
prefixOptionalstringShown before the value in the hover and the legend, such as "$". Up to 80 characters.
suffixOptionalstringShown after the value, such as " kWh". Up to 80 characters.
dataRequiredarrayUp to 1000 rows; may be empty. A grid has at most 60 distinct x values and 60 distinct y values; a calendar's dates span at most 366 days.
Each row in data
FieldTypeRule
<xKey>OptionalstringGrid only, and required there. The column's label, a string ("07", not 7). Up to 80 characters. Each x and y pair appears once.
<yKey>OptionalstringGrid only, and required there. The row's label, a string. Up to 80 characters.
<dateKey>OptionalstringCalendar only, and required there. A real day written YYYY-MM-DD. Each date appears once.
<valueKey>RequirednumberThe number the colour and the hover show.

Good to know

  • On a grid x runs across and y down, each in the order it first appears in data. On a calendar the weeks start on Monday and run from the week of the earliest date to the week of the latest, with month labels.
  • A calendar's dates may span at most 366 days, earliest to latest, both counted; a longer span is refused with the dates to keep. Appending to a calendar keeps the latest 366 days on its own. The latest date sets a calendar's 366-day window: an append drops the days before it and counts them in dropped, and an append that would push every stored day out of it is refused, so a mistyped year cannot erase the calendar.
  • The colour runs from a tint of the scheme's first series colour to the colour itself, lowest value to highest, with a legend. Every cell with a value is filled; a cell with no row is drawn as an empty outline and its hover says No data.
  • Append merges rows by cell: by x and y pair on a grid, by date on a calendar, so a daily job can send only today's row. An older date than the calendar keeps is dropped and counted in dropped, not refused. An append that would make more than 1000 rows is refused; replace the whole list with PUT /v1/visuals/{id}/data instead.

Example

{
  "layout": "grid",
  "xKey": "hour",
  "yKey": "day",
  "valueKey": "kwh",
  "suffix": " kWh",
  "data": [
    { "day": "Mon", "hour": "07", "kwh": 1.4 },
    { "day": "Mon", "hour": "08", "kwh": 0.9 }
  ]
}

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: Waterfall chart JSON format