Tell us what’s happening:
Describe your issue in detail here.
I have this weird issue. I must use index.Year instead of item.Year. Everyone else seems to use item and it works in the rest of the code, but not for tooltip. I don’t understand why.
Below is the piece of code, link to codepen is:
Your code so far
.on('mouseover', (item, index) => {
tooltip.transition()
.style('visibility', 'visible')
if (index.Doping != '') {
tooltip.text(`${index.Year} - ${index.Name} - ${index.Time} - ${index.Doping}`)
} else {
tooltip.text(`${index.Year} - ${index.Name} - ${index.Time} - no allegation`)
}
tooltip.attr('data-year', index.Year)
})
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
Challenge: Visualize Data with a Heat Map
Link to the challenge: