Accepted answer

Projection here contains elements from multiple class. So, select all the lines separately and change their style on mouseover and undo in mouseout part.

Modified functions are below, change the style as you need. Also change .foreground path fill to #ccc(default color).

Hope this helps!

function mouseover(d) {
    svg.classed("active", true);
    projection.classed("inactive", function(p) { return p !== d; });
    projection.filter(function(p) { return p === d; }).each(moveToFront);
    // new line added 
    svg.selectAll(".foreground path").filter(function(p) { 
        return p === d;}).each(function(i) {"stroke", "red")}); }

function mouseout(d) {
   svg.classed("active", false);
   projection.classed("inactive", false);
   // new line here
   svg.selectAll(".foreground path").each(function(i) {"stroke", "#ccc")});

Related Query

More Query from same tag