d3-cloud
d3-cloud copied to clipboard
not-so-simple example
As I understand it, the d3-cloud library only renders a set of {word, size}
pairs into a chart. It does not actually have any functionality to create these pairs, correct? Creating wordcloud will almost always involve converting some big string(s) of text to a set of word/size pairs. Perhaps it would be useful to include an example that illustrates how to go about this? Or perhaps adopt some of this functionality in the library?
Here is a simple text to wordmap function as extracted from your example: http://pastebin.com/yH8cXk5N. Perhaps that would be useful to others as well.
Also it is not working as expected, everytime I referesh the browser it misses some of the words some time. can you check why is it happening ?
I agree it would be useful to include automatic word-frequency computation (and stop-word removal).
@sumitarora, this is expected if there isn't sufficient room left to place a particular word at a particular size. This can happen if you have long words with a large size, or even just long words in general are quite hard to place.
Thanks for the nice implementation! I wish there was a flag that allows to force the cloud to show all words as sumitarora said.
@jasondavies , regarding the word-skipping problem, would it be possible to retry the word at a different position and rotation until it succeeds?