---
title: "Treemap Image API — Weighted category breakdowns | Imejis"
description: "Render treemap images for weighted breakdowns — budget, storage, traffic mix — sized by value and colored by a palette, set per API call. Try Imejis free."
url: "https://www.imejis.io/components/treemap/category"
---

# Treemap Image API — Weighted category breakdowns | Imejis

A weighted breakdown colored by a palette instead of by % change.

## Use cases

- Budget and spend breakdowns
- Storage / disk usage maps
- Traffic-source or revenue-mix graphics

## Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `data` | `object[]` | `[]` | Tiles: array of { label, value, change?, group?, color? }. |
| `colorMode` | `'change' \| 'category'` | `"change"` | 'change' colors tiles red→green by % change; 'category' uses a palette. |
| `positiveColor` | `color` | `"#16a34a"` | Color for a positive change (full intensity). |
| `negativeColor` | `color` | `"#dc2626"` | Color for a negative change (full intensity). |
| `neutralColor` | `color` | `"#475569"` | Color at zero change / when a tile has no change. |
| `maxChange` | `number` | `3` | The % change that maps to full color intensity. |
| `colors` | `color[]` | `[]` | Category palette (cycled) when colorMode is 'category'. |
| `baseColor` | `color` | `"#2563eb"` | Single base color for 'category' mode when no palette is set. |
| `labelColor` | `color` | `"#ffffff"` | Tile text color. |
| `showValues` | `boolean` | `true` | Print the change % or value on each tile. |
| `showGroupLabels` | `boolean` | `true` | Draw the sector/group labels. |
| `valueFormat` | `'number' \| 'compact' \| 'percent' \| 'currency'` | `"compact"` | How values are formatted in category mode (1,200 / 1.2K / $1,200). |
| `currencySymbol` | `string` | `"$"` | Symbol used with the 'currency' format. |
| `gap` | `number` (min 0) | `2` | Padding between tiles (px). |
| `opacity` | `number` | `1` | Overall component opacity from 0 (transparent) to 1 (opaque). |
| `borderWidth` | `number` | `0` | Border thickness in pixels around the component. |
| `borderColor` | `color` | `"transparent"` | Border color (any CSS color). |
| `borderStyle` | `'solid' \| 'dashed' \| 'dotted' \| 'double' \| 'none'` | `"solid"` | Border line style. |
| `borderRadius` | `number` | `0` | Corner radius in pixels. |
| `boxShadow` | `string` | — | CSS box-shadow applied to the component, e.g. "0 4px 6px rgba(0,0,0,0.1)". |

## Design JSON (this variant)

```json
{
  "title": "Treemap sample",
  "description": "A market heatmap of a stock portfolio",
  "dimensions": {
    "width": 800,
    "height": 460
  },
  "background": {
    "color": "#0f172a"
  },
  "components": [
    {
      "id": "sample-treemap",
      "key": "treemap",
      "type": "treemap",
      "position": {
        "x": 40,
        "y": 40
      },
      "rotation": 0,
      "size": {
        "width": 720,
        "height": 380
      },
      "dynamic": true,
      "properties": {
        "data": [
          {
            "label": "AAPL",
            "value": 3120,
            "change": 1.4,
            "group": "Tech"
          },
          {
            "label": "MSFT",
            "value": 2980,
            "change": 0.6,
            "group": "Tech"
          },
          {
            "label": "NVDA",
            "value": 2210,
            "change": 3.8,
            "group": "Tech"
          },
          {
            "label": "GOOG",
            "value": 1780,
            "change": -0.9,
            "group": "Tech"
          },
          {
            "label": "JPM",
            "value": 640,
            "change": -1.2,
            "group": "Finance"
          },
          {
            "label": "BAC",
            "value": 320,
            "change": -0.5,
            "group": "Finance"
          },
          {
            "label": "XOM",
            "value": 470,
            "change": 2.1,
            "group": "Energy"
          },
          {
            "label": "CVX",
            "value": 300,
            "change": 1.3,
            "group": "Energy"
          }
        ],
        "colorMode": "category",
        "maxChange": 4,
        "showValues": true,
        "showGroupLabels": true,
        "opacity": 1,
        "colors": [
          "#2563eb",
          "#7c3aed",
          "#c026d3",
          "#0891b2",
          "#059669",
          "#ea580c"
        ]
      }
    }
  ]
}
```

## Examples

### Storage usage map

Disk usage by folder, sized by GB and colored by a palette.

API overrides that reproduce this example:

```json
{
  "treemap.colorMode": "category",
  "treemap.colors": [
    "#2563eb",
    "#7c3aed",
    "#c026d3",
    "#0891b2",
    "#059669",
    "#ea580c"
  ],
  "treemap.data": [
    {
      "label": "Media",
      "value": 420
    },
    {
      "label": "Backups",
      "value": 260
    },
    {
      "label": "Databases",
      "value": 180
    },
    {
      "label": "Logs",
      "value": 90
    },
    {
      "label": "Cache",
      "value": 60
    }
  ],
  "treemap.valueFormat": "compact"
}
```

### Traffic sources

Sessions by channel, sized by volume for a growth report.

API overrides that reproduce this example:

```json
{
  "treemap.colorMode": "category",
  "treemap.colors": [
    "#0ea5e9",
    "#6366f1",
    "#8b5cf6",
    "#ec4899",
    "#f59e0b"
  ],
  "treemap.data": [
    {
      "label": "Organic",
      "value": 52000
    },
    {
      "label": "Direct",
      "value": 31000
    },
    {
      "label": "Referral",
      "value": 18000
    },
    {
      "label": "Social",
      "value": 14000
    },
    {
      "label": "Email",
      "value": 9000
    }
  ],
  "treemap.valueFormat": "compact"
}
```

## API overrides

Push fresh tiles per render with '<key>.data' (or just '<key>') as [{ label, value, change, group }]; sizes and colors update with them.

Flat override payload (`key.property` addressing) with the sample design's current values — send only the keys you want to change:

```json
{
  "treemap.data": [
    {
      "label": "AAPL",
      "value": 3120,
      "change": 1.4,
      "group": "Tech"
    },
    {
      "label": "MSFT",
      "value": 2980,
      "change": 0.6,
      "group": "Tech"
    },
    {
      "label": "NVDA",
      "value": 2210,
      "change": 3.8,
      "group": "Tech"
    },
    {
      "label": "GOOG",
      "value": 1780,
      "change": -0.9,
      "group": "Tech"
    },
    {
      "label": "JPM",
      "value": 640,
      "change": -1.2,
      "group": "Finance"
    },
    {
      "label": "BAC",
      "value": 320,
      "change": -0.5,
      "group": "Finance"
    },
    {
      "label": "XOM",
      "value": 470,
      "change": 2.1,
      "group": "Energy"
    },
    {
      "label": "CVX",
      "value": 300,
      "change": 1.3,
      "group": "Energy"
    }
  ],
  "treemap.colorMode": "change",
  "treemap.maxChange": 4,
  "treemap.showValues": true,
  "treemap.showGroupLabels": true,
  "treemap.opacity": 1
}
```

```bash
curl --location 'https://render.imejis.io/v1/{{YOUR_DESIGN_ID}}' \
--header 'dma-api-key: {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
    "treemap.data": [
        {
            "label": "AAPL",
            "value": 3120,
            "change": 1.4,
            "group": "Tech"
        },
        {
            "label": "MSFT",
            "value": 2980,
            "change": 0.6,
            "group": "Tech"
        },
        {
            "label": "NVDA",
            "value": 2210,
            "change": 3.8,
            "group": "Tech"
        },
        {
            "label": "GOOG",
            "value": 1780,
            "change": -0.9,
            "group": "Tech"
        },
        {
            "label": "JPM",
            "value": 640,
            "change": -1.2,
            "group": "Finance"
        },
        {
            "label": "BAC",
            "value": 320,
            "change": -0.5,
            "group": "Finance"
        },
        {
            "label": "XOM",
            "value": 470,
            "change": 2.1,
            "group": "Energy"
        },
        {
            "label": "CVX",
            "value": 300,
            "change": 1.3,
            "group": "Energy"
        }
    ],
    "treemap.colorMode": "change",
    "treemap.maxChange": 4,
    "treemap.showValues": true,
    "treemap.showGroupLabels": true,
    "treemap.opacity": 1
}'
```

`{{YOUR_DESIGN_ID}}` and `{{YOUR_API_KEY}}` are placeholders: first create
the design in your account (paste the sample design JSON above into the
editor at https://app.imejis.io, or create it programmatically via the
imejis MCP server's `create_design` + `update_design` tools), then render
it with the design's id and one of your API keys.

Agents: the MCP server at https://api.imejis.io/api/mcp exposes this same
catalog as structured data via the `list_component_types` tool (property
kinds, allowed values, bounds, ready-to-use sample designs).

## Related

- [Treemap component](https://www.imejis.io/components/treemap.md) — full reference and FAQs
- [Light](https://www.imejis.io/components/treemap/light.md) — The market heatmap on a light card for print and docs.
