chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.selectAll("g")
.data(data)
.join("g")
.attr("transform", d => `translate(${x0(d[groupKey])},0)`)
.selectAll("rect")
.data(d => keys.map(key => ({key, value: d[key]})))
.join("rect")
.attr("x", d => x1(d.key))
.attr("y", d => y(d.value))
.attr("width", x1.bandwidth())
.attr("height", d => y(0) - y(d.value))
.attr("fill", d => color(d.key))
.append("title")
.text(d => `${d.value}`);
svg.append("g")
.call(xAxis)
.attr("fill", "white")
.attr("stroke", "white")
.attr("color", "white")
.attr("font-size", 25);
svg.append("g")
.call(yAxis)
.attr("fill", "white")
.attr("stroke", "white")
.attr("color", "white")
.attr("font-size", 18);
return svg.node();
}