chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("fill", "steelblue")
.attr("fill-opacity", 0.8)
.selectAll("rect")
.data(data)
.join("rect")
.attr("x", d => x(d.xAxis))
.attr("width", x.bandwidth())
.attr("y", d => y1(d.bar))
.attr("height", d => y1(0) - y1(d.bar));
svg.append("path")
.attr("fill", "none")
.attr("stroke", "currentColor")
.attr("stroke-miterlimit", 1)
.attr("stroke-width", 3)
.attr("d", line(data));
svg.append("g")
.attr("fill", "none")
.attr("pointer-events", "all")
.selectAll("rect")
.data(data)
.join("rect")
.attr("x", d => x(d.xAxis))
.attr("width", x.bandwidth())
.attr("y", 0)
.attr("height", height)
.append("title")
.text(d => `${d.xAxis}:
${data.y1}: ${d.bar.toLocaleString("en")}
${data.y2}: ${d.line.toLocaleString("en")}`);
svg.append("g")
.call(xAxis);
svg.append("g")
.call(y1Axis);
svg.append("g")
.call(y2Axis);
return svg.node();
}