chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
svg.append("g").call(xAxis);
const axisLinear = svg
.append("g")
.style("opacity", 1)
.call(yAxis, yLinear);
const axisPower = svg
.append("g")
.style("opacity", 0)
.call(yAxis, yPower, ",")
.call(yTickPosition, yLinear);
const path = svg
.append("g")
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 0.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.selectAll("path")
.data(sigmaInterfaces)
.join("path")
.style("mix-blend-mode", "multiply")
.attr("d", line(yLinear));
return Object.assign(svg.node(), {
update(y) {
const t = svg.transition().duration(750);
axisLinear.transition(t).style("opacity", y === yLinear ? 1 : 0)
.call(yTickPosition, y);
axisPower.transition(t).style("opacity", y === yPower ? 1 : 0)
.call(yTickPosition, y);
path.transition(t).attr("d", line(y));
}
});
}