D3 Bar Chart - Bars Drawn Below Axis?

D3 Bar Chart - Bars Drawn Below Axis?


Why are my bars drawing to the bottom of the SVG canvas (or beyond)? I’ve been playing with values for almost 2 hours trying to figure out what’s happening and I’m stuck. I fixed a few other issues while searching for the answer to this problem, but I still can’t figure it out.

I wanted to pass all the tests before worrying about styling, sorry that it’s so small and hard to see. Also, the test that requires the height of the bars to correspond to the GDP value passes, so I’m really not sure what’s going on here with these bars.

Any help will be appreciated. One other minor question:

Should I bother building an array from the JSON data? It seems like an unnecessary extra step to me, but it was easier to visualize at first. I could do away with the json.foreach(), no?