score:1

Accepted answer

Usually I close this question, as it's a duplicate many times over but I'll answer adding a little d3 help along the way.

First, your big problem, d3.json is an async operation. When it completes, it fires a callback function (your second argument to it). The code you have below d3.json that builds your force layour is actually executing before the d3.json finishes. It needs to execute in the callback.

Second, couple svg/d3 things:

  1. Your circles have no radius, they won't appear
  2. You don't position your circles in the tick function
  3. You don't need all the number conversion and float parsing, it isn't doing anything

Here it is running a bit better.


Related Query

More Query from same tag