Need some help with data attributes | D3 Bar Chart Challenge

Hello,
I have just finished my d3 bar chart project.
It looks fine and it passes the tests, yet it really feels like I made a short cut somewhere along the way.
For example, I created a lot of data-something attributes and haven’t used them at all.
If anyone can take a look at my code and try to figure out what might be wrong with it I would be extremely grateful.
https://codepen.io/vasylkb/full/RwrWRYB
Thanks in advance

Hello~!

Are you talking about the attributes like data-date and data-gdp?
When you created them, you were adding them to the HTML output for your D3 graph. This is correct, and allows you (or your user) to see the exact data values if they view the element in the developer tools:


This can be helpful for the debugging process when you’re building the graph, but now that it is done this can also be helpful in case the tooltip doesn’t load properly.

Your graph passes all of the tests, and it looks nice! Well done! :slight_smile:

2 Likes

Got it. Now, it makes sense. :slight_smile:

1 Like