D3 Heat Map project: can't figure out how to pass Content tests 8 and 9

I am currently working on the " Data Visualization Projects - Visualize Data with a Heat Map" project. Here is my project (see the README for build instructions):

gitlab.com/ZebulanStanphill/zeb-fcc-heat-map

Unfortunately, I’ve gotten stuck trying to pass all the tests. Specifically, I can’t figure out the right way to pass Content tests 8 and 9.

In particular, I don’t understand the error message test 8:

data-month should be at most 11: expected '12' to be at most 11

The “month” values in the provided data JSON range from 1-12, not 0-11. It seems to me that the tests are flawed? Or am I just missing something?

I believe that they are looking for the month to be zero-indexed, as most arrays in javascript.

When declaring your data-month, try putting

.attr('data-month', d => d.month - 1)

I’m not exactly sure why the test was written like this, it does seem a bit confusing.

2 Likes