Console error in this challenge

Tell us what’s happening:

Your code so far


<body>
<script>
  const dataset = [
                [ 34,     78 ],
                [ 109,   280 ],
                [ 310,   120 ],
                [ 79,   411 ],
                [ 420,   220 ],
                [ 233,   145 ],
                [ 333,   96 ],
                [ 222,    333 ],
                [ 78,    320 ],
                [ 21,   123 ]
              ];

  const w = 500;
  const h = 500;
  const padding = 60;

  const xScale = d3.scaleLinear()
                   .domain([0, d3.max(dataset, (d) => d[0])])
                   .range([padding, w - padding]);

  const yScale = d3.scaleLinear()
                   .domain([0, d3.max(dataset, (d) => d[1])])
                   .range([h - padding, padding]);

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

  svg.selectAll("circle")
     .data(dataset)
     .enter()
     .append("circle")
     .attr("cx", (d) => xScale(d[0]))
     .attr("cy",(d) => yScale(d[1]))
     .attr("r", (d) => 5);

  svg.selectAll("text")
     .data(dataset)
     .enter()
     .append("text")
     .text((d) =>  (d[0] + "," + d[1]))
     .attr("x", (d) => xScale(d[0] + 10))
     .attr("y", (d) => yScale(d[1]))

  const xAxis = d3.axisBottom(xScale);
  // Add your code below this line
  const yAxis = undefined;
  // Add your code above this line

  svg.append("g")
     .attr("transform", "translate(0," + (h - padding) + ")")
     .call(xAxis);

  // Add your code below this line
  svg.append("g")
     .attr("transform", "translate("+ padding +", 0)")
     .call(yAxis);

  // Add your code above this line

</script>
</body>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:76.0) Gecko/20100101 Firefox/76.0.

Challenge: Add Axes to a Visualization

Link to the challenge:

It is giving me this error:

Build error, open your browser console to learn more.

So I opened my browser console and got this error:

err: Object { message: "Unspecified AssertionError", showDiff: false, stack: "o@https://www.freecodecamp.org/js/vendors~chai.db31e51f102dcec4957b.js:25:477\n361/e.exports/i.prototype.assert@https://www.freecodecamp.org/js/vendors~chai.db31e51f102dcec4957b.js:453:1366\n365/e.exports/e.assert@https://www.freecodecamp.org/js/vendors~chai.db31e51f102dcec4957b.js:490:82\n@https://www.freecodecamp.org/js/frame-runner.841d1da76cdc88e006de.js line 25 > eval:1:7\n_callee$/testPromise</<@https://www.freecodecamp.org/js/frame-runner.841d1da76cdc88e006de.js:25:89569\ns@https://www.freecodecamp.org/js/frame-runner.841d1da76cdc88e006de.js:25:26162\nu/</f<@https://www.freecodecamp.org/js/frame-runner.841d1da76cdc88e006de.js:25:26464\n", … }

What’s up? Please help!

You have not defined your yAxis method yet. :slight_smile:

1 Like

Whoops, thank you! :slightly_smiling_face: