I am having trouble with passing the test number 10: The data-date attribute and its corresponding bar element should align with the corresponding value on the x-axis.
The test says that x values don’t line up with x locations : expected false to be true.
I am stuck at this for days
Can anyone be so kind and look at my code and tell me what is causing the problem?
This error message with false and true is a bit misleading I think…
But the issue is that you are not setting the x-values for your bars properly. Check your line 52: you are setting x to the current index times barwidth… basically a counter that goes up. But actually your x-axis is dates! Your x is just a number, lets say 115, but the data from the json is a date, lets say 2001-10-12.
Try setting your x values in line 52 similar to how you set your xScale in line 17. Dont forget to scale them!