Search code examples
javascriptcsvd3.jsword-cloud

creating word cloud with d3.js


I am trying to create word cloud using d3.js and d3.layout.cloud.js.

For this I am using .csv file which contains rows word,size. But unable to create the file. Unable to understand that where I'am going wrong with this.

Following is my code:

Word Cloud creation using d3.js in .csv


Solution

  • d3.csv is an asynchronous call. That means that it doesn't return anything, you have to process the data in the callback. I've done that (and fixed a few other things) here. I've also limited the font sizes to be between 8 and 24 as the values in your data are rather large.