I need help with the d3 Bar Graph project

It says 1/14 tests passed no matter what I do! I always make sure its testing for the bar graph but it still says that

And I have all the code right (unless I overlooked something) why doesn’t the bar graph show up??

Yeah, I had a lot of problems with d3 in codepen in that if there was a problem with the code, there were no typical javascript errors you can trace, but rather it just wouldn’t draw anything… in troubleshooting my projects, I went as far as appending a circle to svg, and then moving it around in my code… if moved before the error it would draw, if after the error it wouldn’t draw, and I used that sometimes to isolate code errors.

I don’t have a lot of time to review tonight, but just glancing, I see you used d3.svg in your axis creation… I’m not sure d3.svg is a thing.

1 Like

Oh, I just saw javascript error d3 is not defined… it doesn’t appear you imported d3. You can do that with import statements with standard javascript, but with codepen, you go to the settings of your Javascript, and search for d3 and select what you’d want to import, just like you had to do for jquery and React components. What you need depends on what you used… you can compare it to the sample code to see what they have imported if you need to.

1 Like