Tests are broken on "Add Labels to Scatter Plot Circles" lesson in Data Visualization with D3 curriculum

Tell us what’s happening:
The tests are broken on this lesson and the previous one. Both are asking to use positions for the visualizations that are not consistent with the sample dataset provided. I tried creating a second array containing the coordinates mentioned in the test cases but it’s still not passing.

  **Your code so far**
<body>
<script>
  const dataset = [
                [ 34,    78 ],
                [ 109,   280 ],
                [ 310,   120 ],
                [ 79,    411 ],
                [ 420,   220 ],
                [ 233,   145 ],
                [ 333,   96 ],
                [ 222,   333 ],
                [ 78,    320 ],
                [ 21,    123 ]
              ];

  const coords = [
                [ 39,    422 ],
                [ 114,   220 ],
                [ 315,   380 ],
                [ 84,    89 ],
                [ 425,   280 ],
                [ 238,   355 ],
                [ 338,   404 ],
                [ 227,   167 ],
                [ 83,    180 ],
                [ 26,    377 ]
              ];


  const w = 500;
  const h = 500;

  const svg = d3.select("body")
                .append("svg")
                .attr("width", w)
                .attr("height", h);

  svg.selectAll("circle")
     .data(dataset)
     .enter()
     .append("circle")
     .attr("cx", (d, i) => d[0])
     .attr("cy", (d, i) => h - d[1])
     .attr("r", 5);

  svg.selectAll("text")
     .data(dataset)
     .enter()
     .append("text")
     // Add your code below this line
     .attr("x", (d, i) => d[0] + 5)
     .attr("y", (d, i) => h - coords[i][1])
     .text((d, i) => `${d[0]},${d[1]}`);


     // Add your code above this line
</script>
</body>
  **Your browser information:**

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

Challenge: Add Labels to Scatter Plot Circles

Link to the challenge:

You are missing a space inside the template literal.

`${d[0]}, ${d[1]}`

Other than that, using the data the challenge asks for passes the tests.

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