Calling data from an array inside an array

I’m new to javascript and D3.
I’m trying to add a tooltip to a line chart made on D3 for which I need to call data.

The data is inside a group with arrays, and I’m unable to call the data inside the group. In this case ‘country’ and ‘cases’. But because they are in an array inside an array I keep getting ‘undefined’ in the tooltip.

I know this seems basic but I’m stuck. Any ideas?

Screen Shot 2020-11-10 at 9.10.28 PM

hi @san.salcido,

I personally haven’t worked with D3, but I am guessing you are just not calling specific enough information from the data. Have you tried using console.log() on the data and adding specificity?
For example, potentially calling console.log( to see if that shows the information you are looking for?

Looking at the d3 docs your event handler functions are expecting the wrong data to be passed in. The event isn’t passed in, instead the data and index are passed in, the current event is stored in the global d3.event. So you are trying to get data from the index. So you e params should become your d and your d is actually the index.