Data Visualization Projects - Visualize Data with a Heat Map

Tell us what’s happening:

Hello, I’m stuck and don’t know what to do. The heatmap is displayed correctly, but the first two months of 1753 are missing. I’ve displayed circles with the same data, and the circles are there. When I use console.log(data.monthlyVariance.filter(d => d.year === 1753 && (d.month === 1 || d.month === 2)));, the two months are correctly shown. However, in the rect elements, using console.log does not show the first two months of 1753. Can someone please help me?

Your code so far

const rectHeight = (height - 2 * padding) / 12;
const rectWidth = (width - 2 * padding) / (maxYear - minYear);

d3.select(svg)
  .selectAll("rect")
  .data(data.monthlyVariance)
  .enter()
  .append("rect")
  .attr("x", (d) => {
        const x = xScale(parseDate(d.year.toString()));
console.log("Rect X:", x);
return x;
       })
  .attr("y", (d) => yScale(d.month)) //<-- here is 1753 month 1 & 2 not included 
  .attr("width", rectWidth)
  .attr("height", rectHeight)
  .attr("class", "cell")
  .attr("data-month", (d) => d.month-1)
  .attr("data-year", (d) => d.year)
  .attr("data-temp", (d) => tempBase + d.variance)
  .attr("fill", (d) => colorScale(tempBase + d.variance));

console.log(data.monthlyVariance.filter(d => d.year === 1753 && (d.month === 1 || d.month === 2)));
d3.select(svg)

.selectAll(“circle”)
.data(data.monthlyVariance)
.enter()
.append(“circle”)
.attr(“cx”, (d) => xScale(parseDate(d.year.toString())))
.attr(“cy”, (d) => yScale(d.month))
.attr(“r”, 5)
.attr(“fill”, “red”);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

Data Visualization Projects - Visualize Data with a Heat Map

Do you have a link to the IDE, did you pass the test by submitting a link from Code Pen etc. Nothing can be ran on the project page so more information is needed.

I passed the test.

I dont know if this answers your question but I just implemented four colors into the code and it passed all the test.

thanks, I know that. My Problem is the month 1 and 2 in year 1753, they are not on the spot. I don’t know why. In the left top corner they are missing.

I passed the test, but now the first ten months are missing.

That’s really strange. I have no idea what could be causing it.