countryGroups.each((d,i,nodes) => {
let thisCountryCode = d["Country Code"];
let spark = d3.select(nodes[i]).selectAll("line")
.data(gdp_pivot)
.join("line")
.attr("x1", d=>scaleX(+d.Year)).attr("y1",scaleY(0))
.attr("x2", d=>scaleX(+d.Year)).attr("y2",d=>scaleY(+d[thisCountryCode]))
.style("stroke", d => +d[thisCountryCode] > 0 ? "green" : "red");
})