I am using d3.js to load a csv file using d3.csv and store it in 'List'. When I assign the List.length value to a variable (totalElems), the value always comes to 0. However, the List.length does return the actual size of the array. Where am I going wrong ?
N.B:
I am using chrome console for this exercise with python HTTP server
Attached along-with is a screenshot of the error.
Asked
Active
Viewed 41 times
0

user815589
- 41
- 4
-
Post *code*, not a *picture* of code. Pictures are hard to read, and can't be properly indexed by the site (yet; I'm sure they could with enough effort). – T.J. Crowder Apr 13 '16 at 08:38
-
is the variable in the same scope you are trying to access it in? – Velimir Tchatchevsky Apr 13 '16 at 08:39
-
3[`d3.csv`](https://github.com/mbostock/d3/wiki/CSV#csv) is *asynchronous*. – T.J. Crowder Apr 13 '16 at 08:40
-
Thanks a lot for the help. I solved it by converting the files to .json (using a perl script on the fly) and including the same in my script tag programatically. – user815589 Apr 20 '16 at 19:27