Help required for D3 exercise in FCC

I seem to have fulfilled the requirements of the program but it is not recognized.
Exercise: https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles/
I have attached image of results.


Code here:

Why could it be? What can I correct in my code?

Can you share your code instead of screenshot?

1 Like

I realized what I did wrong while solving another exercise. I also displayed " " around the text values, which wasn’t needed at all. The following code works.
Code here:

<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 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 - d[1])
       .text(function(d,i) { return d[0]+", "+d[1];})
       
       
       // Add your code above this line
  </script>
</body>