{
const data = [
{ team: "Ohio State", score: 77 },
{ team: "Michigan", score: 3 }
];
const svg = d3.create("svg").attr("width", 200).attr("height", 200);
const x = d3
.scaleBand()
.domain(data.map((d) => d.team))
.range([0, 150])
.padding(0.1);
const y = d3
.scaleLinear()
.domain([0, d3.max(data, (d) => d.score)])
.range([0, 150]);
svg
.selectAll("rect")
.data(data)
.enter()
.append("rect")
.attr("x", (d) => x(d.team))
.attr("y", 150)
.attr("width", x.bandwidth())
.attr("height", (d) => y(d.score))
.attr("fill", "steelblue");
svg
.selectAll("text")
.data(data)
.enter()
.append("text")
.text((d) => d.score)
.attr("x", (d) => x(d.team) + x.bandwidth() / 2)
.attr("y", (d) => 140 - y(d.score))
.attr("text-anchor", "middle")
.attr("fill", "white");
svg
.append("text")
.text("Halftime Score")
.attr("x", 100)
.attr("y", 20)
.attr("text-anchor", "middle")
.attr("font-size", "16px");
return svg.node();
}