Hi there,
Please see codepen below:
I am having difficulty getting the tooltip #1 to pass with the code that I am writing.
let tooltip=d3.select('#tooltip')
.on('mouseover', (movie)=>{
tooltip.transition()
.style('visibility', 'visible')
let revenue=movie['data']['value'].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
console.log(revenue)
tooltip.html(
'$ ' + revenue + '<hr />' + movie['data']['name']
)
})
.on('mouseout', (movie)=>{
tooltip.transition()
.style('visibility', 'hidden')
})
What could I do (or do differently) considering the code format that I am using(declare tooltip in html, assign to ‘let’ variable in js sheet, and use '.on(‘mouseover’) while declaring another variable ‘revenue’ using ‘regex’)?