chart = {
replay;
const aboveUid = DOM.uid("above");
const belowUid = DOM.uid("below");
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.datum(data);
svg.append("g").call(xAxis);
svg.append("g").call(yAxis);
svg
.append("clipPath")
.attr("id", aboveUid.id)
.append("path")
.attr(
"d",
d3
.area()
.curve(curve)
.x(d => x(d.date))
.y0(0)
.y1(d => y(d.value1))
);
svg
.append("clipPath")
.attr("id", belowUid.id)
.append("path")
.attr(
"d",
d3
.area()
.curve(curve)
.x(d => x(d.date))
.y0(height)
.y1(d => y(d.value1))
);
svg
.append("path")
.attr("clip-path", aboveUid)
.attr("fill", colors[1])
.attr(
"d",
d3
.area()
.curve(curve)
.x(d => x(d.date))
.y0(height)
.y1(d => y(d.value0))
);
svg
.append("path")
.attr("clip-path", belowUid)
.attr("fill", colors[0])
.attr(
"d",
d3
.area()
.curve(curve)
.x(d => x(d.date))
.y0(0)
.y1(d => y(d.value0))
);
svg
.append("path")
.attr("fill", "none")
.attr("stroke", "blue")
.attr("stroke-width", 1.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr(
"d",
d3
.line()
.curve(curve)
.x(d => x(d.date))
.y(d => y(d.value0))
)
.call(transition);
return svg.node();
}