Change the Presentation of a Bar Chart

Can anyone tell me what’s wrong or missed something? It’s not working

Your code so far


<style>
  .bar {
    width: 25px;
    height: 100px;
    /* Add your code below this line */
    margin: 2px;
    /* Add your code above this line */
    display: inline-block;
    background-color: blue;
  }
</style>
<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
    
    d3.select("body").selectAll("div")
      .data(dataset)
      .enter()
      .append("div")
      .attr("class", "bar")
      // Add your code below this line
      .style("height", (d) => (d*10 + "px")

      )

      // Add your code above this line
  </script>
</body>

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart

Your code is working when I paste it in. Try clearing your code and then copying it back in. If that doesn’t work, maybe try a different browser.

1 Like

It worked. Thanks a lot for your help

1 Like