Treemap in D3.js - Tooltip test #1

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’)?

I approached the problem that I was having using a different coding set-up(i.e. alternate code) and answered my question on how to more effectively utilize the tooltip “hover over” feature. I no longer need assistance on this item because all the tests are passing now for this project.

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