WordTree: retreive Datatable row of selected word from user

85 views
Skip to first unread message

Andres Felipe San Martin

unread,
Nov 27, 2014, 9:09:49 AM11/27/14
to google-visua...@googlegroups.com
Hi,

I've been trying to retreive the Datatable row of a selected word in a WordTree Chart and failing miserably at it.

Considering the explicit case:

var nodeListData = new google.visualization.DataTable();

nodeListData.addColumn('number', 'id'); nodeListData.addColumn('string', 'childLabel'); nodeListData.addColumn('number', 'parent'); nodeListData.addColumn('number', 'size'); nodeListData.addColumn('number', 'color');

nodeListData.addRow([0, 'Life', -1, 1, 0]);
nodeListData.addRow([1, 'Archaea', 0, 1, 0]);
nodeListData.addRow([2, 'Eukarya', 0, 5, 0]);

var options = {wordtree: {format: 'explicit'}};
var mywordtree = new google.visualization.WordTree(document.getElementById('wordtree_explicit'));
google.visualization.events.addListener(mywordtree, 'select', myClickHandler);
mywordtree.draw(nodeListData, options);

function myClickHandler(){
//this just has 3 properties (word, weight and color) var selectedItem = mywordtree.getSelection();
//trying with any method of the Datatable gives no results probably due to the fact that it is not the object drawn on the page
.....
}

I would be very grateful if someone could help in this regard.

The purpose behind this effort is being able to uniquely identify a user-selected word of the charted wordtree.

Thank you in advance.

Felipe.


Sergey Grabkovsky

unread,
Dec 1, 2014, 11:17:51 AM12/1/14
to google-visua...@googlegroups.com
Hi Andres,

I can certainly see how this would be useful, but we don't currently support this method of identifying a word. I think your best bet is to create a map of word to row index that you would look it up.
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Axel Soto

unread,
Jun 16, 2016, 6:38:19 AM6/16/16
to Google Visualization API
The problem with this solution is that a word can map to multiple indexes if the word is repeated
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages