chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
svg
.append("g")
.attr("fill", "steelblue")
.selectAll("rect")
.data(data.map((d) => (d["gender assortativity"] > 0 ? d : { value: 0 })))
.join("rect")
.attr("x", (d, i) => x(i))
.attr("y", (d) => y(d["gender assortativity"]))
.attr("height", (d) => y(0) - y(d["gender assortativity"]))
.attr("width", x.bandwidth());
svg
.append("g")
.attr("fill", "coral")
.selectAll("rect")
.data(data.map((d) => (d["gender assortativity"] < 0 ? d : { value: 0 })))
.join("rect")
.attr("x", (d, i) => x(i))
.attr("y", (d) => y(0))
.attr("height", (d) => y(0) - y(-d["gender assortativity"]))
.attr("width", x.bandwidth());
svg.append("g").call(xAxisPos);
svg.append("g").call(xAxisNeg);
svg.append("g").call(yAxis);
return svg.node();
}