chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append("g")
.attr("fill", "steelblue")
.attr("stroke-width", 10)
.attr("pointer-events", "all")
.selectAll("rect")
.data(data)
.join("rect")
.attr("x", d => x(d.value) - 0.75)
.attr("y", d => y(d.age))
.attr("width", 1.5)
.attr("height", y.bandwidth())
.append("title")
.text(d => `${d.name}
${(d.value * 100).toFixed(1)}% ${d.age}`);
return svg.node();
}