chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
const g = svg.append("g").attr("fill", color);
g.selectAll("rect")
.data(sortedData)
.join("rect")
.attr("x", (d, i) => x(i))
.attr("y", d => y(d.value))
.attr("height", d => y(0) - y(d.value))
.attr("width", x.bandwidth())
.style("opacity", 0.1);
g.selectAll("circle")
.data(sortedData)
.join("circle")
.attr("cx", (d, i) => x(i) + x.bandwidth() / 2)
.attr("cy", d => y(d.value))
.attr("r", x.bandwidth() / 8);
g.selectAll("path")
.data([sortedData])
.join("path")
.attr("d", d => line(d))
.attr("fill", "none")
.attr("stroke", color);
svg.append("g").call(xAxis);
svg.append("g").call(yAxis);
return svg.node();
}