When to Use
Use treemap charts when you need to:- Show hierarchical data with proportional sizes
- Display disk usage and file system structures
- Visualize budget allocations and resource distributions
- Compare market shares or sales by category
- Analyze nested data with multiple levels
- Represent part-to-whole relationships in hierarchies
Basic Configuration
A treemap chart requires hierarchical data with numeric values that determine rectangle sizes.Complete Example
Here’s a comprehensive example showing disk space usage:Key Options
Data Structure
Hierarchical data nodes. From TreemapSeries.ts:139-153, 222
Node Click Behavior
Behavior when clicking a node. From TreemapSeries.ts:203, 280
'zoomToNode': Zoom into the clicked node'link': Navigate to URL specified in node datafalse: No action
Layout Configuration
The golden ratio for rectangle layout. From TreemapSeries.ts:183, 265Controls the aspect ratio preference for rectangles.
Nodes at this depth from root are treated as leaves. From TreemapSeries.ts:188, 266Useful for limiting visible hierarchy levels.
Sort order for nodes at same level. From TreemapSeries.ts:176, 262
trueor'desc': Descending by value'asc': Ascending by valuefalse: No sorting
Breadcrumb Navigation
Breadcrumb navigation configuration. From TreemapSeries.ts:205-218, 284-302
Visual Mapping
Which dimension to use for visual mapping. From TreemapSeries.ts:106, 346
Color saturation range for visual mapping. From TreemapSeries.ts:117, 361Array of two numbers defining min/max saturation (e.g., [0.3, 0.7]).
Color alpha (opacity) range for visual mapping. From TreemapSeries.ts:116, 360
Minimum value for visual mapping. From TreemapSeries.ts:113, 347
Maximum value for visual mapping. From TreemapSeries.ts:114, 348
Visibility Control
Minimum area (px²) for a node to be visible. From TreemapSeries.ts:125, 363Nodes smaller than this won’t be rendered.
Minimum parent area (px²) for children to be visible. From TreemapSeries.ts:129, 365If a parent node’s area is smaller than this, its children won’t be shown.
Item Style
Node rectangle styling. From TreemapSeries.ts:64-73, 326-335
Labels
Label for regular nodes. From TreemapSeries.ts:304-314
Label shown for parent nodes. From TreemapSeries.ts:316-325Displayed when a node has children and is being viewed.
Levels
Level-specific configurations. From TreemapSeries.ts:132-137, 220, 370Each array element configures a specific depth level. Level 0 is the root, level 1 is its children, etc.Each level can have its own
itemStyle, label, upperLabel, color, and visual mapping settings.Interaction
Whether to enable zoom and pan. From TreemapSeries.ts:278
Target node area ratio when zooming. From TreemapSeries.ts:196, 271
Emphasis
What to highlight on hover. From TreemapSeries.ts:92
'self': Only the hovered node'descendant': The node and all descendants'ancestor': The node and all ancestors
Layout Box
Distance from left edge. From TreemapSeries.ts:257
Distance from top edge. From TreemapSeries.ts:258
Distance from right edge. From TreemapSeries.ts:259
Distance from bottom edge. From TreemapSeries.ts:260
Best Practices
- Use meaningful color schemes to encode additional dimensions
- Set
gapWidthto visually separate sibling nodes - Configure
levelsfor different visual styles at each hierarchy depth - Use
upperLabelto show parent names when zoomed in - Enable breadcrumb navigation for easy hierarchy navigation
- Set appropriate
visibleMinto hide very small rectangles - Use
nodeClick: 'zoomToNode'for interactive drill-down exploration - Consider using
colorSaturationorcolorAlpharanges for value encoding