chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("fill", "#1DA1F2")
.selectAll("rect")
.data(data)
.join("rect")
.attr("x", x(0))
.attr("y", (d, i) => y(i))
.attr("width", d => x(d.value) - x(0))
.attr("height", y.bandwidth());
svg.append("g")
.attr("fill", "white")
.attr("text-anchor", "end")
.attr("font-family", "sans-serif")
.attr("font-size", 30)
.selectAll("text")
.data(data)
.join("text")
.attr("x", d => x(d.value) - 4)
.attr("y", (d, i) => y(i) + y.bandwidth() / 2)
.attr("dy", "0.35em")
.text(d => format(d.value));
svg.append("g")
.attr("font-size", 32)
.call(xAxis);
svg.append("g")
.call(yAxis)
.attr("font-size", 32);
return svg.node();
}