D3 Bar Graph - Finished

D3 Bar Graph - Finished


US GDP Bar Graph

For the design, I stuck close to the example. I wasn’t able to come up with a way to make it responsive.

I had some trouble with getting the tests about aligning bars to the x and y axis to pass. For the x-axis, it passed when I called ticks() on the axis, which I used to format the years without commas. For the y-axis, I had previously reversed the order of the y scale domain to get the y-axis showing right-side up. This was causing the y-axis alignment test to fail, so I had to set that straight. I forgot exactly why, but I think the way I was calculating bar height at first must have given incorrect results when the y-axis was scaled properly, but looked right when I reversed the order of the domain.