Tell us what’s happening:
hey i am not able to pass the tests in the second fcc project ,however i tried it in codesandbox it works fine there , iin codepen there is an error in the tooltip part , please hep so that i can pass the test.
Hi @hussamkhatib. You are using the most recent version of d3.js. There are some changes which are not backwards compatible and most tutorials are using older versions. You can read more about the migration guide Here. Your major problem is in the parameters to the mouseover event handler. The handler is now in the form below:
selection.on("mousemove", function(event, d) {
… do something with event and d …
})
The first parameter is the event and the second is the data. In your code you are using the first parameter to access the data yet it is the event. The second parameter to the event handler is the data and it is the one you should use to get Name, Nationality, Year etc.
Since you are using d3 version 6, you can get the mouse position using d3.pointer(event) which returns the x and y coordinates of the current mouse position as an array of 2 elements. If I replace your mouseover event handler with the code below, all the tests pass.