Heat Map - Test 9 Fails ( and a question more )

Hi! im trying to finish the Heat Map project on Data Visualization.I watched a video of Florin Pop to understand better how the Heat Map works but i have a problem : the test 9 fails (“My heat map should have cells that align with the corresponding month on the y-axis”).I tried to modify the “y” on “rect” but i cant find the error.

Also i want to know if there is a way to do a “console.log” of the values of the variables xScale,yScale,xAxis and yAxis.

Thanks!

For the error, just look at your visualization. The months start at December and end in November and the axis ticks are at the top of each row and not the middle of each row. You may want to try the band scale or adjust your labels and tick positions.

You can log what the scale and axis values are as you generate them by changing

    .attr('x', d => xScale(d.year))

to

    .attr('x', d => {
      console.log(xScale(d.year));
      return xScale(d.year);
    })

or you can run the project locally and you can see the values for the SVG elements in the page source in the browser console.

I changed the yScale.domain to ([1, 12]) ( before was [0,11] ) and the months start in January and i deleted the “-cellHeight” from “y: yScale(d.month - 1)-cellHeight” and now Works!
Thank you so much!

1 Like

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