score:2

Accepted answer

In the brushed() and zoomed() functions, you are only updating the green line (extra VS. date). You have to identify each line (for example with a specific class), and update both using their respective d3.line functions:

Line_chart.append("path")
    .datum(data)
    .attr("class", "line line-extra") // <-- class added here
    .style("stroke", "green")
    .attr("d", line);

Line_chart.append("path")
    .datum(data)
    .attr("class", "line line-speed") // <-- and here
    .style("stroke", "blue")
    .attr("d", line1);

[...]

function updateLines() {
  Line_chart.select(".line-extra").attr("d", line);
  Line_chart.select(".line-speed").attr("d", line1);
}

function brushed() {
  [...]
  updateLines();
}

function zoomed() {
  [...]
  updateLines();
}

Related Query

More Query from same tag