-Create a Bar for Each Data Point in the Set-Solved

-Create a Bar for Each Data Point in the Set-Solved
0

#1

Tell us what’s happening:
Where is my wrong?Can you tell me?

Your code so far


<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
    
    const w = 500;
    const h = 100;
    
    const svg = d3.select("body")
                  .append("svg")
                  .attr("width", w)
                  .attr("height", h);
    
    svg.selectAll("rect")
       // Add your code below this line
       d3.select("body").selectAll("div")
       .data(dataset)
       .enter()
       .append("div")
       
       
       // Add your code above this line
       .attr("x", 0)
       .attr("y", 0)
       .attr("width", 25)
       .attr("height", 100);
  </script>
</body>

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/create-a-bar-for-each-data-point-in-the-set


#2

What seems to be the problem? What errors are you seeing? What tests are you failing?


#3

I have try some codes and i get it thank you for answer.I pass the test.thank you for answer.


#4

In the future, when you end up solving the challenge on your own without help. Just reply back to the original post and say you figured out the solution and then check the box which will mark it as “Solved” like shown below.

Thank you.


#5

Thank you :slightly_smiling_face:


#6
<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
    
    const w = 500;
    const h = 100;
    
    const svg = d3.select("body")
                  .append("svg")
                  .attr("width", w)
                  .attr("height", h);
    
    svg.selectAll("rect")
       // Add your code below this line
        
    .data(dataset)
       .enter()
       .append("rect")
       
        // Add your code above this line
       .attr("x", 0)
       .attr("y", 0)
       .attr("width", 25)
       .attr("height", 100);
  </script>
</body>