lineLabels = g => g.selectAll("text")
.data(dataSeries)
.join("text")
.text(d => d.name)
.attr("paint-order", "stroke")
.attr("stroke", "white")
.attr("stroke-width", 1.5)
.attr("fill", d => d.label.color)
.attr("x", d => x(dataX[d.label.i]))
.attr("y", d => y(d.mean[d.label.i]))
.attr("alignment-baseline", "middle")
.attr("class", "xsmall-copy font-bold")
.each(function (d) {
const t = d3.select(this);
switch (d.label.orient) {
case "t": t.attr("text-anchor", "middle").attr("dy", "-0.8em"); break;
case "tr": t.attr("text-anchor", "start").attr("dx", "0.6em").attr("dy", "-0.8em"); break;
case "tl": t.attr("text-anchor", "end").attr("dx", "-0.6em").attr("dy", "-0.8em"); break;
case "b": t.attr("text-anchor", "middle").attr("dy", "0.8em"); break;
case "br": t.attr("text-anchor", "start").attr("dx", "0.6em").attr("dy", "0.8em"); break;
case "bl": t.attr("text-anchor", "end").attr("dx", "-0.6em").attr("dy", "0.8em"); break;
case "r": t.attr("text-anchor", "start").attr("dx", "0.6em"); break;
case "l": t.attr("text-anchor", "end").attr("dx", "-0.6em"); break;
}
})