The solution fails for: "Data Visualization with D3: Add Labels to Scatter Plot Circles"

https://www.freecodecamp.org/learn/data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles
When the official solution is entered: .text((d) => (d[0] + ", " + d[1])) the tests do not pass. Nor do the tests pass for .text((d) => ((d[0]+5) + ", " + d[1])). How can the tests be passed?

1 Like

Hi @super. The tests are not passing because there is something you are missing. You should have "x" and "y" attributes included as well:

 .attr("x", (d, i) => d[0] + 5)
 .attr("y", (d, i) => h - d[1])

1 Like

Hello there,

For future posts, if you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

This code still does not pass the test.

1 Like

Well obviously that code alone won’t pass the tests because I didn’t include everything you are supposed to have. There should be a line of code for displaying label. The code I have provided is simply for positioning the labels. Saying “This code still does not pass the test” doesn’t tell me what is wrong with your code. Just copy and paste the solution you are submitting and include a link to the particular challenge like @Sky020 pointed out to easily help you.

Copy and pasting the solution does not work, it appears the solution is wrong.

1 Like

Well nobody is here to give you solutions. The best one can do is guide you and obviously you are making it difficult for people to do so.

Hey all, let us remember that there is a person on the other end of the keyboard.

@super If you are still stuck, could you please include your current (full), up-to-date code?

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Like I previously mentioned, to complete the challenge I entered incorrect code, then went to the official freecodecamp solution and copy pasted that into the challenge, and still the test did not pass.

Right. Sorry, I missed that clarification.

You are correct. The guide post solution does not pass the current tests. Thank you, for pointing this out.

I have corrected the guide post.

Much appreciated, thanks!

Please thoroughly read and understand before making any comments.