This post describes how to build a very basic
treemap with d3.js. It takes into
account a hierarchy dataset, stored at .csv format. See
many other examples in the
treemap section of the gallery. Learn
more about the theory of treemaps in
data-to-viz.com. This example works with d3.js v4 and v6
div that will be modified by d3 later on.
svg area. It specify the chart size and its
margin. Read more.
d3.stratify() function is thus needed for
reformatting.
read more.
d3.treemap() function can be used to
compute the rectangle coordinates of each entity of the
hierarchy.
rect and
text.