D3 TreeMap Diagram - Test #6 won't pass

I have almost finished this last Data Visualization Project. But I can’t seem to pass Test #6: The area of each tile should correspond to the data-value amount: tiles with a larger data-value should have a bigger area. I think it might have to do with round off of the areas.

Here is my project: https://codepen.io/webmachine/pen/ReLqEG

Could somebody please take a look at the code, and help me figure out how I can pass this test? Thank you.

1 Like

I figured out what the problem was, and I’m very unhappy about this test. It turns out it was a round off issue caused by my original width and height for the entire diagram. When I changed that width and height to the same dimensions as the sample solution, the area calculations worked out.

This test failure was not caused by a problem with my code, but with not choosing the exact size of the containing svg to fit in with the test values.

I wasted hours hunting for my mistake. :frowning:


I agree with you. Having to rely on some fixed values is against all programming principles.

Thanks a lot. Set treemap().round() to true would lead to this problem.

That fixed it for me, thanks akidox!

Thank you, you’ve saved me a lot of time.
Was copying the .round(true) from another template and the test output is not really pointing to that.

I had the same issue, yet my problem was the shape of my treemap. Be advised your project would not pass the 6th test if your treemap is a squire. Have a good day :slight_smile: