Failing test on D3 Bar Chart project

Tell us what’s happening:
I can’t figure out why the test #10 is failing. The x positioning and the translate of the x-axis are the same. :thinking:

Your code so far
Here is the code on CodePen

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36.

Challenge: Visualize Data with a Bar Chart

Link to the challenge:

2 Likes

Try using scaleTime for your x-axis instead of scaleLinear. I’ve stumbled upon the same issue and this has fixed it for me.

If you haven’t seen scaleTime before you should be able to learn how to use it from D3js docs at this point. You should take a look at d3.timeParse and d3.timeFormat too, it will help you with converting strings to javascript Date objects and you gonna need it to find min and max dates with d3.min and d3.max.

Learning scaleTime seems a must to me, since it’s gonna be used in future d3 projects as well.

2 Likes

Thank you Ygor. I’ll take a look at that!

It worked! Thank you very much!