d3: make the d3.csv function syncronous

d3.csv is asynchronous by design to prevent pages from freezing up, so that can’t be changed without changing the d3 library itself.

However, you could pre-load all your files via d3.text() and call d3.csv.parse or d3.csv.parseRows, which will be synchronous given that the text file has been loaded.

For an example, see Mike Bostock’s answer in this post this post.

Leave a Comment