I have a chart with lines in it, and when I mouseover a line I want to display a text in the svg. Here is the code :
let lines = svg.append("g").attr("class", "lines");
        lines
            .selectAll(".line-group")
            .data(data)
            .enter()
            .append("g")
            .attr("class", "line-group")
            .on("mouseover", function (d, i) {
                console.log(d.name)
                svg
                    .append("text").attr("class", "title-text")
                    .style("fill", color(i))
                    .text(d.name + "efzeiufzihefizeifiu")
                    .attr("text-anchor", "middle")
                    .attr("x", 200)
                    .attr("y", 30);
            })
            .on("mouseout", function (d) {
                svg.select(".title-text").remove();
            })
I have no error, and the mouseover is working fine as I can see in the console the value of d.name, however there is no text attribute adding in the svg. I inspired myself from : https://codesandbox.io/s/multi-line-chart-example-wrxvs, which is doing basically the same thing, but it adds the text when hovering. Any idea ?