D3 TreeMap Diagram - Test #6 won't pass

D3 TreeMap Diagram - Test #6 won't pass
0

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.

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:

2 Likes

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!