chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
let line = d3.line()
.defined(([, value]) => value != null)
.x(([key, value]) => x[key](value))
.y(([key]) => y(key))
const marks = svg.append("g")
.attr("fill", "none")
.attr("stroke-opacity", opacity)
.attr("stroke-linejoin", "round")
.selectAll("path")
.data(data)
.join("g")
.call(g => {
g.append("path")
.attr("stroke", "white")
.attr("class", "shadow")
.attr("stroke-width", 5)
.attr("d", d => line(d3.cross(keys, [d], (key, d) => [key, d[key]])))
g.append("path")
.attr("class", "foreground")
.attr("stroke-width", 2)
.attr("stroke", d => z(d[CATEGORY]))
.attr("d", d => line(d3.cross(keys, [d], (key, d) => [key, d[key]])))
})
marks.on("mouseover", (event, me) => {
if(me[CATEGORY] !== currentSemester && me[CATEGORY] !== "angie") return;
marks.selectAll("path").style("stroke-opacity", d => d == me ? 1 : 0.2)
marks.selectAll(".shadow").style("stroke-width", d => d == me ? 10 : 2)
marks.selectAll(".foreground").style("stroke-width", d => d == me ? 6 : 2)
});
marks.on("mouseout", (event, me) => {
if(me[CATEGORY] !== currentSemester && me[CATEGORY] !== "angie") return;
marks.selectAll("path").style("stroke-opacity", opacity)
marks.selectAll(".shadow").style("stroke-width", 5)
marks.selectAll(".foreground").style("stroke-width", 2)
});
svg.append("g")
.selectAll("g")
.data(keys)
.join("g")
.attr("transform", d => `translate(0,${y(d)})`)
.each(function(d) { d3.select(this).call(d3.axisBottom(x[d])); })
.call(g => g.append("text")
.attr("x", margin.left)
.attr("y", -6)
.attr("text-anchor", "start")
.attr("stroke-width", 6)
.attr("opacity", textOpacity)
.attr("stroke", "white")
.style("paint-order", "stroke")
.style("font-size", "5em")
.attr("stroke-linejoin", "round")
.attr("fill", "currentColor")
.text(d => d.replace("How would you rate your ", "").replace("skills?", ""))
)
return svg.node();
}