While completing the first Data Visualization project - “Visualize Data with a Bar Chart” - I initially had a lot of issues getting the tests to pass, even though I had fulfilled all the user stories properly. I found that not everything was explained in FCC’s curriculum. So, I just wanted to share a couple of tips/pointers for anyone out there who might be pulling their hair out trying to get their tests to pass.
Ignore the FCC “Add a Tooltip to a D3 Element” challenge - this method will work fine, but the tests will fail. Instead you need to create a tooltip like a modal. I don’t think FCC covers modals at all, but there are plenty of tutorials out there. In short, you want to create a div element that appears when the bars are hovered over. And I just passed all the info the modal needs via data attributes.
I hope that helps anyone. Here is a link to my completed Bar Chart project, if anyone is still confused and wants to take a look: https://codepen.io/andytburke/full/OJEyJGd