D3 Bar Chart 1 User Test 12

Hi there,

The following is my codepen: Codepen Bar Chart

I have been trying to complete each user story as I progress but am unable to pass User Test 12. Could you please tell me what I have done wrong as from my eye it appears that I have got the x values to line up with the x locations?

If only computers saw as we do…

If I remember correctly, this test compares the data stored in the data-date attribute of each bar and compares it with the values of each tick. Looking at the source just now, it treats numbers (thousands) differently than dates. This test is expecting ticks to be years and yours are numbers (thousands). Or in other words, 1,950.0 is not equal to 1950-01-01.

I would try a time scale for the x-axis and maybe use d3.timeParse() to help with the date parsing. A time scale would be easier than trying to get the tests to pass with a linear scale.

1 Like

Ah I understand now. That makes a lot of sense, I didn’t quite understand what was being tested there. This clears up a lot, I shall attempt what you have suggested :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.