Question

Issue with word cloud custom visualization


Hi All,


Has anybody experienced an issue with the word cloud visualization provided in the github samples, where the can not be more than one visible on a dashboard at a time?


I can get one to display by using ‘clear cache and refresh’ but then the others disappear 😦


has anyone else solved / encountered that issue?


Thanks!


12 replies

Userlevel 4

The word cloud visualization refers to the ID of the div as mydiv when it draws the visualization. This is seen here: https://github.com/looker/visualization-api-examples/blob/master/examples/word_cloud/word_cloud.js#L34


What does work is writing a new div id, such as appending a random number the element ID. This would make each one unique and fix your problem.


var myhash = settings.title+settings.id;
selector = "#" + myhash
...

.attr('id', myhash);



In the above case, wherever you refer to #mydiv you would need to refer to selector


Let us know if that works.

Userlevel 7
Badge

can we see an updated version of this in the looker github please 😉

Thanks Eric!


I’ll give it a try

Hi Eric,


Using the settings didn’t work for some reason, but using a random number:


		var myhash = 'wordcloud' + Math.floor((Math.random() * 1000000) + 1);
selector = "#" + myhash;

worked 🙂


However, now I have a different problem- If I change the filters on the dashboard the word clouds don’t change, nor do they change if I clear cache & refresh.

They do update if I go into ‘explore from here’ and come back into the dashboard, could this be a caching issue?


Any suggestions would be greatly appreciated.


Thanks,

Userlevel 4

I’ve actually updated it to work correctly in the github repository. It no longer call’s the div by id and therefore does not update tiles outside of the element it is in



Thanks Eric!

Hi @eFein,


The fix worked great on ver 4.16 but as of this afternoon when we upgraded to 4.18.13 it doesn’t work at all.


Any idea what could have caused the problem?


If it helps the console shows: “d3.layout.cloud is not a function”


Thanks!

It turns out these two lines were the problem, after commenting them out is working again:


if (typeof define === "function" && define.amd) define(["d3"], cloud);
else cloud(this.d3);
Userlevel 2

Hey @ishai-smadja


Thank you for bringing this to our attention. I am glad you figured it out so quick.

Hi ishai,


Did this continue to work for you? We recently upgraded to 4.18.20 and we are getting the same error, and commenting out those two lines doesn’t seem to work 😕

I found @eFein, I know this viz is unsupported, but any ideas? Thanks!

Got it working after a bit of messing around.


Rather than modify the two lines above as @ishai-smadja suggested, I just kept cloud(this.d3); and removed everything else on those lines.

Reply