chart = {
const svg = d3.create("svg").attr("width", width).attr("height", height);
svg
.selectAll("rect")
.data(groupedData)
.join("rect")
.attr("width", xScale.bandwidth())
.attr("height", (d) => height - yScale(d.number))
.attr("x", (d) => xScale(d.country))
.attr("y", (d) => yScale(d.number))
.attr("fill", (d) => colorScale(d.country))
;
svg.append("g")
.style("transform", `translate( 0px, ${height-margin.bottom }px)`)
.call(xAxis);
svg.append("g")
.style("transform", `translate( ${margin.left}px, 0px)`)
.call(yAxis);
return svg.node();
}