Skip to documentation content

Documentation · Data

Treemap

Write every item with its value, and put the items that belong together in a group. Every cell is as big as its value, so the whole sheet is the total.

When to use it

Show how a whole divides into parts, and those parts into smaller ones, when there are too many for a pie: a budget by department and line, disk use by folder, or exports by sector and product.

A cell's area is its value, so compare cells by area, not by position. Group items that belong together, and keep to two levels; a cell too small for its name is left blank, and its value is still in the panel.

Working example

Copy this complete example into the Source tab, then press Generate. Change its labels or values to make your first version.

Tingraph source
treemap "University spending 2026" {
  unit "$m"
  share on
  group "Teaching" {
    "Engineering" 42
    "Medicine" 38
    "Sciences" 27
    "Humanities" 14
  }
  group "Research" {
    "Grants" 31
    "Laboratories" 18
    "Library" 7
  }
  group "Operations" {
    "Estates" 22
    "IT" 12
    "Administration" 9
  }
  "Student services" 11
}

Syntax reference

The same reference used by the editor and AI briefing. Syntax is notation-specific; use the keywords listed here.

Figure

SyntaxMeaning
treemap "Title" {open a treemap

Items and groups

SyntaxMeaning
"Gold" 25an item, as big as its value
Gold 25a one-word name needs no quotes
"Gold" 25 "#eda100"pin an item's colour
group "Chemicals" { ... }items that belong together, drawn inside one group
group "Chemicals" "#2a78d6" { ... }pin a group's colour, which its items take

Look

SyntaxMeaning
unit "$bn"written after every value
values offleave the values out of the cells
share onwrite each item's share of the whole
colors colorfulink (outlines on paper) or colorful (a hue per group)
text 13caption size, 9 to 22
size 760 440width and height on the sheet
# commentline comment (also //)

Language rules

  • The file is one treemap "Title" { ... } block. Nothing may sit outside it.
  • An item is "Name" 25: a name and a value above 0. A name with no space needs no quotes.
  • A group is group "Name" { ... } around the items that belong together. It holds items only, never another group, and at least one of them. A group's size is its items' values added up.
  • Items may also stand on their own beside the groups. Write values on one scale: they are all parts of the same whole.
  • A colour is "#rrggbb", after a group's name for the group and every item in it, or after a standalone item's value. An item inside a group takes the group's colour.
  • Settings are written as name value, in any order.
  • Do not invent settings. Every one the language has is listed above.

Edit on the canvas

  • Pick a cell, a group's band or the title on the sheet and rename it in place; remove a cell or a whole group, or give a group another item.
  • Set every value, group colours, values, shares and the unit in the Treemap panel.

Generate replaces the drawing from source. Save before generating again if you want to preserve manual finishing touches.

Read Saving & exporting

Write it with an assistant

Tingraph AI already knows this notation. For another assistant, copy the tutorial below, describe your diagram under MY DIAGRAM, then paste the returned source into the editor. This prompt includes every syntax row, rule and working example above.

Read the complete prompt
You are writing Tingraph source. Tingraph is a small text language that draws a treemap. Answer with Tingraph source only.

SYNTAX
Figure
  treemap "Title" {           open a treemap

Items and groups
  "Gold" 25                   an item, as big as its value
  Gold 25                     a one-word name needs no quotes
  "Gold" 25 "#eda100"         pin an item's colour
  group "Chemicals" { ... }   items that belong together, drawn inside one group
  group "Chemicals" "#2a78d6" { ... }  pin a group's colour, which its items take

Look
  unit "$bn"                  written after every value
  values off                  leave the values out of the cells
  share on                    write each item's share of the whole
  colors colorful             ink (outlines on paper) or colorful (a hue per group)
  text 13                     caption size, 9 to 22
  size 760 440                width and height on the sheet
  # comment                   line comment (also //)

RULES
- The file is one `treemap "Title" { ... }` block. Nothing may sit outside it.
- An item is `"Name" 25`: a name and a value above 0. A name with no space needs no quotes.
- A group is `group "Name" { ... }` around the items that belong together. It holds items only, never another group, and at least one of them. A group's size is its items' values added up.
- Items may also stand on their own beside the groups. Write values on one scale: they are all parts of the same whole.
- A colour is `"#rrggbb"`, after a group's name for the group and every item in it, or after a standalone item's value. An item inside a group takes the group's colour.
- Settings are written as `name value`, in any order.
- Do not invent settings. Every one the language has is listed above.

WORKED EXAMPLE
treemap "University spending 2026" {
  unit "$m"
  share on
  group "Teaching" {
    "Engineering" 42
    "Medicine" 38
    "Sciences" 27
    "Humanities" 14
  }
  group "Research" {
    "Grants" 31
    "Laboratories" 18
    "Library" 7
  }
  group "Operations" {
    "Estates" 22
    "IT" 12
    "Administration" 9
  }
  "Student services" 11
}

OUTPUT
- Reply with one fenced code block and nothing else.
- The block starts with `treemap "…" {` and ends with `}`.
- Do not invent keywords: use only the ones listed above.
- Keep labels short enough to read inside a box, and keep every ID unique.

MY DIAGRAM
Describe what you want here, then send this message.
How AI requests, attachments and privacy work

Something unclear? Contact support or read the Privacy Policy.