Why won't my bar chart pass these test?

Hi everyone! I’m starting the D3 challenges and am already getting tripped up. Here’s the CodePen, and you can see it’s failing tests 9 and 11, both having to do with the height of the bars. Number 9 is as follows: “Each bar element’s height should accurately represent the data’s corresponding GDP.” I’m failing that in the test results because “The heights of the bars should correspond to the data values : expected ‘48.620’ to equal ‘48.280’”. How is it possible that I’m failing this test by such a tiny margin? As far as I know I’m using D3’s scale functions correctly. Thanks for any help!

The rightmost bar extends upward past the maximum value on your y-axis, so there’s either a problem of shifting the bars vertically the wrong amount, or your y-scale function needs an adjustment. You’ll probably have to play around with the values until you get things to match up.

Wow, so obvious! For some reason it didn’t occur to me that that was related—of course it must be. Thanks for putting your eyes on it!

1 Like