Need help to fix tooltip

Hi!! I’m sorry to bother you guys too much, I would like to finish this visualization. I’m just doing it to learn at home.

The tooltip does not move when using the brush function. I am testing several alternatives.

I’m trying to add to (brush) something like:".tooltip").remove() and remove the mouseleave from (chart)

many thanks!!!

The bisect function has a bug. Not sure what it is, but it could be something to do with the pointers X value being parsed is ignored/not read and is defaulting to 0