function changeChart(positiveColor, options, f1, f2) {
const [T, X, Y] = simulate(options);
const height = 240;
const margin = {top: 20, right: 30, bottom: 30, left: 40};
const x = d3.scaleLinear().domain([0, 24]).range([margin.left, width - margin.right]);
const y = d3.scaleLinear().domain([0, 4]).range([height - margin.bottom, margin.top]);
const svg = d3.select(DOM.svg(width, height));
const positive = DOM.uid("positive");
const negative = DOM.uid("negative");
const defs = svg.append("defs");
defs.append("clipPath").attr("id", positive.id).append("path")
.attr("d", d3.area().x(x).y0(0).y1((t, i) => y(f2(X[i], Y[i])))(T));
defs.append("clipPath").attr("id", negative.id).append("path")
.attr("d", d3.area().x(x).y0(0).y1((t, i) => y(f1(X[i], Y[i])))(T));
svg.append("g")
.attr("transform", `translate(0,${y(0)})`)
.call(d3.axisBottom(x))
.call(g => g.select(".tick:first-of-type text").text("t = 0"));
svg.append("g")
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y).ticks(5, "+f"));
svg.append("path")
.attr("clip-path", positive)
.attr("fill", positiveColor)
.attr("fill-opacity", 0.7)
.attr("d", d3.area().x(x).y0(y(0)).y1((t, i) => y(f1(X[i], Y[i])))(T));
svg.append("path")
.attr("clip-path", negative)
.attr("fill", negativeColor)
.attr("fill-opacity", 0.7)
.attr("d", d3.area().x(x).y0(y(0)).y1((t, i) => y(f2(X[i], Y[i])))(T));
svg.append("path")
.attr("fill", "none")
.attr("stroke", color1)
.attr("stroke-width", 1.5)
.attr("d", d3.line().x(x).y((t, i) => y(f1(X[i], Y[i])))(T));
svg.append("path")
.attr("fill", "none")
.attr("stroke", color2)
.attr("stroke-width", 1.5)
.attr("d", d3.line().x(x).y((t, i) => y(f2(X[i], Y[i])))(T));
return svg.node();
}