chart4 = {
const svg = d3.create("svg")
.attr("viewBox", [0,0, width, height]);
const zx = shape_x.copy();
const line = d3.line()
.x(d => zx(d.date))
.y(d => shape_y(d.close));
const path = svg.append("path")
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 1.5)
.attr("stroke-miterlimit", 1)
.attr("d", line(shape_data));
const gx = svg.append("g")
.call(shape_xAxis, zx);
const gy = svg.append("g")
.call(shape_yAxis, shape_y);
return Object.assign(svg.node(), {
update(domain) {
const t = svg.transition().duration(750);
zx.domain(domain);
gx.transition(t).call(shape_xAxis, zx);
path.transition(t).attr("d", line(shape_data))
}
})
}