Possible solution: The d3.csv(...) call is asynchronous, so it may not be executed completely by the time you get to "console.log(...)"

Suggest, as an intermediate hack, put a sleep timeout for a few seconds, and see if that helps.

If it does, you would probably want to restructure your code to take into account the asynchronous nature of the call. This could mean handling all of your logic from inside the d3.csv() call

Related Query

More Query from same tag