treemap = {
const _infections = infections
.filter((d) => d.id.length <= 3)
.filter((d) => d.date === "2021-12-01")
.map((d) => ({
name: countries.find((dd) => dd.id === d.id)
? countries.find((dd) => dd.id === d.id).country
: "",
continent: countries.find((dd) => dd.id === d.id)
? countries.find((dd) => dd.id === d.id).continent
: "",
parent: "world",
...d
}));
const data = d3.group(
_infections,
(d) => d.continent,
(d) => d.name
);
let tree = d3.hierarchy(data).sum((d) => d.total_cases);
let _treemap = d3
.treemap()
.size([width, (width * 9) / 16])
.padding(0.5)(tree);
return tree;
}