Skip to main content
100%

Treemap Template in React

✓ Published0🌍 Public
Iiblub
Last edited Oct 9, 2021
Created on Oct 9, 2021

This treemap displays hierarchical data with three group leaders and fourteen employees, using color to distinguish parent categories and labels to show names and values. Built with React and D3 v5, the visualization constructs the layout using `d3.hierarchy` and `d3.treemap`, while `d3.scaleOrdinal` assigns colors. The chart renders as SVG, with React’s `.map()` method generating rectangles and text elements instead of traditional D3 joins. Data is fetched asynchronously from a remote JSON file using `d3.json` within a React hook.

AI-generated description

This is a recreation of the Treemap Customization. It is rewritten to use React instead of only d3, if you come from the 2021 Data Visualization course, this template will be more understandable for you.

It also has an example using react hooks to "convert" the code.

MIT Licensed

Similar vizzes