Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Word Clouds

Hi everyone

I've started to look at a Javascript library that can produce word clouds.  You can find the details below

http://code.google.com/p/nebulos/

I've started to try and create the extension but i'm having a few problems.  I've tweaked things slightly to get things working but i'm still struggling.  This is a littel side project and not related to any project but it would be good to get it working so that others can use it.  I previously found a Word Cloud extension that used Wordle to produce it (see below) 

http://community.qlik.com/qlikviews/1045

However this JS library seemed to allow for an extension that wouldn't imbed the result in a web page.

If we can get it sorted then everyone can make use of it

On a seperate note is anyone keeping a library of created extensions that could form the start of a shared catalogue?

Thanks

Lewis

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

Hey Lewis,

This should get you started. I have built something similar from scratch for an facebook/twitter app but this looks more promising and alot less effort to maintain.

For very large amounts of text I still would like to move the calculation of words out of the object into the QV engine instead since it's server side and much faster. In my loadscript I calculate the frequency of words and add counters instead. But that could easily be incorporated into this lib aswell.

As for an central repository it would be an awesome idea. We have an internal project for this but I guess GitHub, or something similar, would be better so external people would gain access.

Edit: I just checked your qvw and you did exactly what I proposed above, sorry about that
As for the script.js:

//Declare variables for unique divIDs

var r=Math.floor(Math.random()*10001);

var divName = "div" + r;

//Changed load order. Makes more sense to load libs before init of the object fires.

Qva.LoadScript ("/QvAjaxZfc/QvsViewClient.aspx?public=only&name=Extensions/WordCloud/nebulos-min.js", function () {

          Qva.AddExtension('WordCloud', function() {

                                //Check for existing objects so updates works

                              if (this.Element.children.length == 0) {

                              var ui = document.createElement("div");

                              ui.setAttribute("id",divName);

                              ui.setAttribute("style","width: 100%; height: 100%");

                              this.Element.appendChild(ui);

                              }

                              var vis = new metaaps.nebulos(ui);

                               // pass it a text string - Either a field with data or a result from an expression could go here

                              var myText = "in-memory analytics business discovery more corporate buzzwords then I can think off";

                              vis.draw(myText);  

          });

});

Vault Dweller approves!

View solution in original post

4 Replies
Alexander_Thor
Employee
Employee

Hey Lewis,

This should get you started. I have built something similar from scratch for an facebook/twitter app but this looks more promising and alot less effort to maintain.

For very large amounts of text I still would like to move the calculation of words out of the object into the QV engine instead since it's server side and much faster. In my loadscript I calculate the frequency of words and add counters instead. But that could easily be incorporated into this lib aswell.

As for an central repository it would be an awesome idea. We have an internal project for this but I guess GitHub, or something similar, would be better so external people would gain access.

Edit: I just checked your qvw and you did exactly what I proposed above, sorry about that
As for the script.js:

//Declare variables for unique divIDs

var r=Math.floor(Math.random()*10001);

var divName = "div" + r;

//Changed load order. Makes more sense to load libs before init of the object fires.

Qva.LoadScript ("/QvAjaxZfc/QvsViewClient.aspx?public=only&name=Extensions/WordCloud/nebulos-min.js", function () {

          Qva.AddExtension('WordCloud', function() {

                                //Check for existing objects so updates works

                              if (this.Element.children.length == 0) {

                              var ui = document.createElement("div");

                              ui.setAttribute("id",divName);

                              ui.setAttribute("style","width: 100%; height: 100%");

                              this.Element.appendChild(ui);

                              }

                              var vis = new metaaps.nebulos(ui);

                               // pass it a text string - Either a field with data or a result from an expression could go here

                              var myText = "in-memory analytics business discovery more corporate buzzwords then I can think off";

                              vis.draw(myText);  

          });

});

Vault Dweller approves!

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Lewis,

I've got this QV open source project http://qlikviewcomponents.org going. It's currently focused on scripting, but I had planned to include extensions in the future. PM me if you'd like to discuss setting up an extension repository there or just want some tips for setting up your own.

-Rob

Not applicable
Author

Alexander

Thanks for this.  I can't take scredit for the QVW as that came from a previous community post! But that said, calculating the words in the QVW is the way i'd have approached it. 

Just tried the extension and its running without error now although its not showing any text - i'll keep looking at it and see how i get on.

Rob,

Relly interesting what you have done with qlikviewcomponents and this is definitely the right way forward.  Makes sense that if soemthing exists then we make use of it as a central repository.  There are a lot of really good extensions being done but a lot of the time its a case that you stumble across something in the community pages - centralising it means that we can all benefit!  i'll PM you seperately on your thoughts for how this moght be best to move forward.

Lewis

Not applicable
Author

Hi Lewis,

I did some changes to your original extension (based on the suggestions that Alexander gave you) and managed to make it work using "The Count of Monte Cristo" from within the application and now it responds to selections.

In addition I erased the alerts that came with the nebulos library so the refresh is not that obvious.

I know it's been a long time, but I hope it still works for you.

Regards