My inspector says my code does what's asked but still I don't pass the test

Tell us what’s happening:

the goals to be met are: " The first rect should have a y value of 64.

The second rect should have a y value of 7.

The third rect should have a y value of 34."

and so forth, but despite the DOM inspector says I’m meeting the goals I can’t pass muster whem I hit “run the test”. What can be wrong? What can I do?

Your code so far


<body>
<script>
const dataset = [36, 93, 66, 51, 75, 54, 87, 42, 27];

  const w = 500;
  const h = 100;

  const svg = d3.select("body")
                .append("svg")
                .attr("width", w)
                .attr("height", h);

  svg.selectAll("rect")
     .data(dataset)
     .enter()
     .append("rect")
     .attr("x", (d, i) => i * 30)
     .attr("y", (d, i) => {
          return h - d
     })
     .attr("width", 25)
     .attr("height", (d, i) => 3 * d);
</script>
</body>

Your browser information:

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

Challenge: Invert SVG Elements

Link to the challenge:

Your bars do not have the correct height.

y = heightOfSVG - heightOfBar

Remember that the height of the bar is 3 times the data value d.

1 Like