Hierarchy

Show nested structures such as organizations and category groups.

Hierarchy

The smallest runnable chart

Explore the chart and its data table. Open the code below to use this example.

Basic example

Loading

Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

View code and settings

Browser API

Graflume.treemap()

const data = [
  {
    "id": "Statground",
    "parent": "",
    "value": 100
  },
  {
    "id": "Visualization",
    "parent": "Statground",
    "value": 46
  },
  {
    "id": "Data products",
    "parent": "Statground",
    "value": 34
  },
  {
    "id": "Documentation",
    "parent": "Statground",
    "value": 20
  },
  {
    "id": "Canvas charts",
    "parent": "Visualization",
    "value": 28
  },
  {
    "id": "Spatial charts",
    "parent": "Visualization",
    "value": 18
  },
  {
    "id": "Catalog",
    "parent": "Data products",
    "value": 14
  },
  {
    "id": "Workbench",
    "parent": "Data products",
    "value": 12
  },
  {
    "id": "Pipelines",
    "parent": "Data products",
    "value": 8
  },
  {
    "id": "Guides",
    "parent": "Documentation",
    "value": 12
  },
  {
    "id": "Examples",
    "parent": "Documentation",
    "value": 8
  }
];

const options = {
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "parent": "parent"
    }
  },
  "width": "container",
  "x": {
    "field": "id",
    "title": "Portfolio node",
    "type": "ordinal"
  },
  "y": {
    "field": "value",
    "title": "Relative investment",
    "type": "quantitative"
  }
};

Graflume.treemap('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "parent": "parent"
    }
  },
  "width": "container",
  "x": {
    "field": "id",
    "title": "Portfolio node",
    "type": "ordinal"
  },
  "y": {
    "field": "value",
    "title": "Relative investment",
    "type": "quantitative"
  }
}
Quick API
treemap()
Browser snapshot
graflume
mark
treemap
Presets
7
  • minimal-implementation

Common features

Features shared by every chart

Use the tabs to compare header, tooltip, theme, legend, highlight, callout, selection, view controls, and accessibility one feature at a time. Hover over a data mark. On supported charts, move the pointer along the axis to see the nearest value. All exact values are available in the table below.

Header

Add a chart title and supporting description inside the visualization.

Loading

Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

View code and settings

Browser API

Graflume.treemap()

const data = [
  {
    "id": "Statground",
    "parent": "",
    "value": 100
  },
  {
    "id": "Visualization",
    "parent": "Statground",
    "value": 46
  },
  {
    "id": "Data products",
    "parent": "Statground",
    "value": 34
  },
  {
    "id": "Documentation",
    "parent": "Statground",
    "value": 20
  },
  {
    "id": "Canvas charts",
    "parent": "Visualization",
    "value": 28
  },
  {
    "id": "Spatial charts",
    "parent": "Visualization",
    "value": 18
  },
  {
    "id": "Catalog",
    "parent": "Data products",
    "value": 14
  },
  {
    "id": "Workbench",
    "parent": "Data products",
    "value": 12
  },
  {
    "id": "Pipelines",
    "parent": "Data products",
    "value": 8
  },
  {
    "id": "Guides",
    "parent": "Documentation",
    "value": 12
  },
  {
    "id": "Examples",
    "parent": "Documentation",
    "value": 8
  }
];

const options = {
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "parent": "parent"
    }
  },
  "title": {
    "subtitle": "Tree map uses runnable data and options to demonstrate nested icicle.",
    "text": "Hierarchy"
  },
  "width": "container",
  "x": {
    "field": "id",
    "title": "Portfolio node",
    "type": "ordinal"
  },
  "y": {
    "field": "value",
    "title": "Relative investment",
    "type": "quantitative"
  }
};

Graflume.treemap('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "parent": "parent"
    }
  },
  "title": {
    "subtitle": "Tree map uses runnable data and options to demonstrate nested icicle.",
    "text": "Hierarchy"
  },
  "width": "container",
  "x": {
    "field": "id",
    "title": "Portfolio node",
    "type": "ordinal"
  },
  "y": {
    "field": "value",
    "title": "Relative investment",
    "type": "quantitative"
  }
}
  • header