chart_4 = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.style("font", "14px sans-serif");
var root = data_2;
var treemapLayout = d3.treemap()
.size([width, height])
.paddingOuter(50);
treemapLayout(root);
var root_shifted = root.descendants();
svg.selectAll('g rect')
.data(root_shifted)
.enter()
.append('rect')
.attr('x', d => d.x0)
.attr('y', d => d.y0)
.attr('width', d => d.x1 - d.x0)
.attr('height', d => d.y1 - d.y0)
.attr('fill', 'pink')
.style("stroke", "#000")
.attr('opacity', '0.35')
svg.selectAll('g rect')
.data(root_shifted)
.enter()
.append('text')
.text(d => d.data.country)
.attr('dx', d => d.x0)
.attr('dy', d => d.y0)
var nodes = svg.selectAll('g rect')
.selectAll('g')
.data(root.descendants())
.enter()
.append('g')
.attr('transform', d => 'translate(' + [d.x0, d.y0] + ')');
nodes
.append('rect')
.attr('width', function(d) { return d.x1 - d.x0; })
.attr('height', function(d) { return d.y1 - d.y0; });
nodes
.append('text')
.attr('dx', 4)
.attr('dy', 14)
.text(d => d.data.department);
svg.append('text').text('Treemap of Met data by Department')
.attr('x', 20)
.attr('y',40)
.style('font-weight', '600')
.style('font-size', '2rem')
return svg.node();
}