Output Charts

Docs · Visuals

Treemap JSON format.

Shares of a whole as rectangles sized by value, for when a pie has too many slices.

Try it

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

The visual
Treemap

Change any number or label. The chart follows.

Fields

The treemap document
FieldTypeRule
nameKeyRequiredstringThe key in each row that holds the item's name. Up to 80 characters.
valueKeyRequiredstringThe key in each row that holds the item's value. Up to 80 characters. Must differ from nameKey.
groupKeyOptionalstringThe key in each row that holds the item's group, one level of groups. Up to 80 characters. Must differ from nameKey and valueKey. Without it the items stand alone.
formatOptionalstringnumber (the default), compact or percent. A percent value is a fraction: 0.25 shows as 25%.
prefixOptionalstringShown before every figure, such as "$". Up to 80 characters.
suffixOptionalstringShown after every figure, such as " k". Up to 80 characters.
dataRequiredarrayUp to 200 items, from at most 12 groups; may be empty.
Each row in data
FieldTypeRule
<nameKey>RequiredstringThe item's name. Up to 80 characters. Unique within its group, or within the whole treemap without groupKey; one name may sit in two groups.
<valueKey>RequirednumberThe item's size: a number, 0 or more.
<groupKey>OptionalstringRequired on every row when groupKey is set. The item's group. Up to 80 characters. At most 12 distinct groups.

Good to know

  • Items at 0 are not drawn but count in the summary.
  • Each group is a block in its own colour, its name on it. After six groups the colours repeat and the names tell them apart.
  • A label sits inside a rectangle when it fits; hover shows every item's name and value.
  • A treemap holds no row list: to change it, send the whole document with PUT /v1/visuals/{id}/data.

Example

{
  "nameKey": "merchant",
  "valueKey": "spent",
  "groupKey": "category",
  "prefix": "$",
  "data": [
    { "category": "Home", "merchant": "Rent", "spent": 1800 },
    { "category": "Food", "merchant": "Grocer", "spent": 420 },
    { "category": "Food", "merchant": "Cafe", "spent": 220 }
  ]
}

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: Sankey diagram JSON format