Accepted answer

When you write

.on("mousemove", mousemove());

it is immediately call the mousemove function and passes its return value as the listener function to the "mousemove" event. Because you are not setting correctly the this that is why d3.mouse(this) returns null.

The fix is very easy: just pass in your mousemove function as reference and don't call it:

.on("mousemove", mousemove);

However even after this fix you will still get an error in the fiddle because your bisectDate function is missing...

Related Query