Accepted answer

You can wrap the two function calls you want to make in an anonymous function, e.g.

.on("click", function(d){;

Note that since and tip.hide both require data d as an argument, you need to pass that to them. Recall that when passing an anonymous callback function to .on("click", callback), D3 passes:

the current datum d and the current index i, with the this context as the current DOM element

to the callback function (docs).

Related Query

More Query from same tag