tooltip = {
chart;
const tooltip = d3
.select("body")
.append("div")
.attr("class", "svg-tooltip")
.style("position", "absolute")
.style("visibility", "hidden");
d3.selectAll("path")
.on("mouseover", function(d, i) {
d3.select(this)
.attr('stroke-width', '2')
.attr("stroke", "black")
.style('fill', "yellow");
const keyValues = series.map(function(d) {
return d.key.toString().split(',');
});
tooltip.style("visibility", "visible").text(keyValues[i]);
})
.on("mousemove", function(d, i) {
tooltip
.style("top", d3.event.pageY - 10 + "px")
.style("left", d3.event.pageX + 10 + "px");
})
.on("mouseout", function(d, i) {
d3.select(this)
.attr('stroke-width', '0')
.style("fill", ({ key }) => color(key));
tooltip.style("visibility", "hidden");
});
}