Skip to content
IndexRequest a UIAboutContact

Treemap Proportional Blocks

Rectangles sized by value pack into one frame; hover, focus or tap a block for its share. Two datasets to compare.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean treemap infographic of a household budget in one rectangle split into seven blocks sized by amount, the largest block Housing in deep blue, then Food, Transport, Savings and smaller blocks for Health, Leisure and Other, using lightness steps of one blue hue from dark to light, thin white gaps between blocks, labels with percentages inside the larger blocks, flat vector style. Negative: rainbow colours, 3D, shadows, text errors, pie charts. Reduced motion: static chart.

About this pattern

Definition

A treemap shows parts of a whole as rectangles whose area equals the value. It uses space very efficiently, so it handles many categories where a pie chart would fail, and the biggest items are obvious at a glance. It is poor for precise comparisons of similar sizes.

Purpose & UX principles

  • Area, not width or height, encodes the value.
  • Sort largest to smallest and split the frame alternately by columns and rows.
  • Label the big blocks; show the rest on hover or focus.
  • Use one hue family with lightness steps, not a rainbow.

Interaction states

  • Two dataset buttons; blocks respond to hover, focus and tap.

Motion specification

  • Highlight changes instantly.
  • Reduced motion: nothing animates.

Responsive behaviour

  • Make every block keyboard focusable and announce its name and share.
  • Provide the numbers in a table for people who need exact values.

Code

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Data"><button data-p="0" aria-pressed="true">Budget</button><button data-p="1" aria-pressed="false">Storage</button></div><div class="tm" id="tm"></div><p class="out" id="out" role="status"></p></div>

Related patterns

Donut Chart with Linked Legend

↗
Donut Chart with Linked LegendData Visualization

Stacked Bars with Series Toggle

↗
Stacked Bars with Series ToggleData Visualization

Sortable Ranking Bars

↗
Sortable Ranking BarsData Visualization