Reusable Sharepoint content word cloud
Yet another installment of the making patterns series: Reusable Sharepoint content word cloud. This time it’s less of a pattern and more of a reusable object. This one came about because I needed a visual way to analyze some content in a Sharepoint list. I know I have seen word clouds on Sharepoint blogs so I thought it would be simple to find one that would work on any arbitrary set of lists and columns. My searching came up empty, whole bunch of people using the tag cloud web part. That’s not what I needed so I wrote one.
The code is up on my git page YNV Max Powers
The two functions that do the core of the word cloud work are buildFrequencyHash and makeDiv. Both are pretty self-explanatory and have some comments. The build Frequency hash does just that and counts the frequency of words and stores that in a hash where word is the key. Make div uses the frequency of the word to determine the size. It randomly assigns a color and location within the document.
The loadRequests function uses Sharepoints restfull api to query the list(s) so you don’t have to run this in the context of Sharepoint but the URL you give to loadRequests functions should be something from the ListData.svc. I have locally used this library to create word clouds from arbitrary text files on my desktop also. A sample call to create the word cloud is: