How can I add event listeners?

I has created a D3 Bar Chart project. Everything is working except the tooltip. I don’t know how the example page work but mine isn’t working. Every time the event is emitted, the error come out which say cannot read property 0 of undefined. I add the event listener as the example page does but the error is still there.

Project Link:

I might be blind, but I don’t see an event listener in your code (Handling Events).

Did you try just using a title, like in the challenge Add a Tooltip to a D3 Element

.text((d) => d);

@lasjorg Ah… Sorry I deleted it.
I have added the title elements but the test said

I can mouse over an area and see a tooltip with a corresponding id=“tooltip” which displays more information about the area
Tooltip should be hidden when mouse is not on an area: expected false to be true

@lasjorg It is working now. Thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.