Tests failing in d3.js

hi ! i am not able to clear the test cases , but everything looks working alright to me .
test case 9,10 and 11 are being failed .
can you have a look what is going wrong .
here is the link to codepen
thank you

Test 10: year values don’t line up with x locations

Test: 12 expected NaN to be at least 1753

I was able to fix these to by tweaking tick format of your x-axis, because years are displayed with a comma inside 1,800 - that’s why there is NaN in your tests.

Test 9 however is more complicated and I think the main problem is that you’re using a scale that is nor really meant for this type of data You’re using scale linear where I think more suitable would be either scale band or scale ordinal.

1 Like

thank you very much !
yes indeed, scaleBand() worked for me and removing commas from tick format solved the remaining test cases.
Any suggestion for resources regarding d3.js as i’m finding the docs and other resources hard to follow and depending solely on fcc cirrculum is’nt a
good option as i;m doing the mistake of scaleLinear etc

Good job! :smiley:

Yeah… docs aren’t very beginner friendly.

The best resource I can recommend is freeCodeCamp course on youtube by Curran Kelleher:

It’s very complete course and he explain each topic very thoughtfully. I learned a lot not only about d3.js but also about JavaScript and programming concepts in general :slight_smile:

2 Likes