Update the Height of an Element Dynamically [Data Visualization with D3]

Update the Height of an Element Dynamically [Data Visualization with D3]
0.0 0

#1

Tell us what’s happening:

I’ve done as the exercise asks, and the output draws/renders the image as expected… But none of the tests pass. Anyone able to get this working? Do I have errors that need to be addressed or is there more that should be in there?

Your code so far

<spoiler>
<style>
  .bar {
    width: 25px;
    height: 100px;
    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+"px");

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/update-the-height-of-an-element-dynamically


#2

Mine failed using Chrome but passed when I used Firefox


#3

Mine too. Fails on Chrome works on Firefox.

It is usually the other way around…