Display Shapes with SVG - help!

Display Shapes with SVG - help!
0

#1

Tell us what’s happening:
I don’t understand ! please, help 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)
                  // Add your code below this line
                   svg.selectAll("rect")
                  .data(dataset)
                  .enter()
                  .append("rect")
                  .attr("x", 0)
                  .attr("y", 0)
                  .attr("width", 25)
                  .attr("height", 100);    
                  
                  
                  // Add your code above this line
  </script>
</body>

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/display-shapes-with-svg


#2

The svg constant is already defined in the original code (const svg = ...) and it has appended the svg element.
What you should do is to ‘continue’ the definition of the constant appending the rect as you did: the only problem is that you restarted the definition ( using a dataset not needed atm).

To be short, if you remove the first four rows you wrote the code should pass the challenge^^


#3

thank you, it’s ok !