When I tried to set the tooltip attribute with the corresponding data-year value and run it, it failed.
//here is my code with the mouseover event handler scope
tooltip.attr(“data-year”, d.Year)
For us to help you with this, we’ll need a little more context.
Can you share your full code please (or a link to it)?
okay, here is the link to my code
Since d3 v6 you are required to pass ‘event’ as the first argument to mouse listeners:
So just change this:
let mouseover = d => {
To this:
let mouseover = (e, d) => {
…and your tooltips should work properly.
Thanks for your suggestion, but it didn’t pass the test.
When I made that single modification to your pen, all tests passed and the tooltips worked properly. When I click through to your pen, it doesn’t look like you’ve modified the code.
Well, I figured I should add e.preventDefault(), and it works.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.