function drawData(bounds, data) {
bounds
.append("line")
.attr("x1", -25)
.attr("y1", yScale(0))
.attr("x2", dms.boundedWidth)
.attr("y2", yScale(0))
.style("stroke", "black")
.style("stroke-width", "0.5");
bounds
.append("line")
.attr("x1", xScale(2021))
.attr("y1", 0)
.attr("x2", xScale(2021))
.attr("y2", dms.boundedHeight + 25)
.style("stroke", "black")
.style("stroke-width", "0.5");
bounds
.append("path")
.datum(data.filter((d) => xAccessor(d) < 2022))
.attr("fill", "none")
.attr("stroke", "black")
.attr("stroke-width", 3.8)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr(
"d",
d3
.line()
.x((d) => xScale(xAccessor(d)))
.y((d) => yScale(yAccessor(d)))
);
bounds
.append("path")
.datum(data.filter((d) => xAccessor(d) >= 2021))
.attr("fill", "none")
.attr("stroke", "black")
.attr("stroke-width", 3.8)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr(
"d",
d3
.line()
.x((d) => xScale(xAccessor(d)))
.y((d) => yScale(yAccessor(d)))
)
.style("stroke-dasharray", "1,9");
bounds
.selectAll("circle")
.data(data)
.join("circle")
.attr("cx", x)
.attr("cy", y)
.attr("r", 5.5)
.attr("stroke", "white")
.attr("stroke-width", "1")
.attr("fill", "black");
bounds
.append("g")
.selectAll("dot")
.data(data)
.enter()
.append("text")
.attr("class", "score")
.attr("x", x)
.attr("y", y)
.style("text-anchor", "start")
.attr("dx", -12)
.attr("dy", -22)
.text((d) => d3.format(".1f")(yAccessor(d)));
bounds
.append("g")
.selectAll("rect")
.data(data.filter((d) => xAccessor(d) >= 2022))
.enter()
.append("rect")
.attr("width", 15)
.attr("height", (d) => yScale(d.war_lo) - yScale(d.war_mean))
.attr("x", (d, i) => xScale(xAccessor(d)) - 7.5)
.attr("y", y)
.attr("fill", "grey")
.style("opacity", 0.3);
bounds
.append("g")
.selectAll("rect")
.data(data.filter((d) => xAccessor(d) >= 2022))
.enter()
.append("rect")
.attr("width", 15)
.attr("height", (d) => yScale(d.war_mean) - yScale(d.war_hi))
.attr("x", (d, i) => xScale(xAccessor(d)) - 7.5)
.attr("y", (d) => yScale(d.war_hi))
.attr("fill", "grey")
.style("opacity", 0.3);
}