Skip to content
Advertisement

D3.js rect no display on chart

I started the D3.js challenge on FreeCodeCamp, the problem is that I solved it with the chart but it only gives me a display on the rectum, only one with the width and height that it I put, I’ll show the code below.

The entire code on

JavaScript

Now, what I need to do to display the charts!

I mention that the script tags are embedded in the body

Advertisement

Answer

  1. Problem: Arrow functions without a return value. Solution: Instead use an explicit or an implicit return.
JavaScript
  1. Problem: Fixed height value. Solution Evaluate the height of each based on the GDP value (d[1]) instead.
JavaScript

Full solution in this codepen

Solution screenshot

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement