Hello,
First, as left click will move down the tree, so I want to use mouse
over to display some information for the current view. Assume I just
want to display the node name. However, when I move mouse over, the
parent will always be selected. For example, we are at "global" view
(example data), "var selection = treemap.getSelection();" will select
"global" but not "Africa".
Could anyone give me some suggestions?
(If I replace the "onmouseover" to "select", the display is correct.
However, in this case left click corresponds to two events, which is
not I want.)
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Location');
data.addColumn('string', 'Parent');
data.addColumn('number', 'Market trade volume (size)');
data.addColumn('number', 'Market increase/decrease (color)');
data.addRows([
/* Assume data here are the same as the example data. */
]);
var treemap = new
google.visualization.TreeMap(document.getElementById('visualization'));
treemap.draw(data, {
minColor: 'red',
midColor: '#ddd',
maxColor: '#0d0',
headerHeight: 15,
fontColor: 'black',
showScale: true});
google.visualization.events.addListener(treemap, 'onmouseover',
MouseOver);
function MouseOver(e)
{
var selection = treemap.getSelection();
var node_name = data.getValue( selection[0].row, 0 );
document.getElementById('display').innerHTML= "Node
Name:" + node_name ;
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.