Why is my tooltip flashing on and off?

d3.js, tooltip

Solution

I think it's to do the the `mouseover`/`mouseout` continuosly firing when they needn't:

updated fiddle (again): http://jsfiddle.net/zhMQ8/3/

g.on("mouseover", function() { tooltip.style("display", null); });

g.on("mouseout", function() { tooltip.style("display", "none"); });

g.select(".overlay").on("mousemove", mousemove);

Problem

I am creating a tooltip after this example. For some reason, my tooltip flashes on and off as I move the mouse. As I understand it, the `mousemove()` function finds the closest datapoint; so as long as the mouse is over the `.overlay` rectangle, the tooltip should always be showing. Any ideas? Here's my fiddle: http://jsfiddle.net/samselikoff/zhMQ8/1/

Original source