{
const svg = d3.select(DOM.svg(width + margin.left + margin.right, height + margin.left + margin.right));
svg
.append("rect")
.attr("width", "100%")
.attr("height", "100%")
.style("fill", "#F5F5F2");
const voronoi = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
const labels = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
let seed = new Math.seedrandom(20);
let voronoiTreeMap = d3.voronoiTreemap()
.prng(seed)
.clip(ellipse);
voronoiTreeMap(taxonomy_hierarchy);
colorHierarchy(taxonomy_hierarchy);
let allNodes = taxonomy_hierarchy.descendants()
.sort((a, b) => b.depth - a.depth)
.map((d, i) => Object.assign({}, d, {id: i}));
let hoveredShape = null;
let allNode = [allNodes[0]]
voronoi.selectAll('path')
.data(allNodes)
.enter()
.append('path')
.attr('d', d => "M" + d.polygon.join("L") + "Z")
.style('fill', d => d.parent?.color)
.attr("stroke", d=> "black")
.attr("stroke-width", d=> d.height===1 ? 7 : d.height+1 )
.style('fill-opacity',d=> d.height===0 ? 1 : 0)
.attr('pointer-events', d => d.depth === 2 ? 'all' : 'none');
labels.selectAll('text')
.data(allNodes.filter(d => d.height === 0))
.enter()
.append('text')
.attr('class', d => `label-${d.id}`)
.attr('text-anchor', 'middle')
.attr("transform", d => "translate("+[d.polygon.site.x, d.polygon.site.y+6]+")")
.text(d => d.data.node_attributes[0].name)
.attr('opacity', 1)
.attr('cursor', 'default')
.attr('pointer-events', 'none')
.attr('fill', 'black')
.style('font-family', 'Montserrat')
.style('font-size', '7px');
return svg.node();
}