Hi,
I am trying to do this:
Display a column chart initially, and on clicking on any of the bars
in that chart should display an another chart.
The first step is complete, I am trying to implement the second
feature now, by adding a Listener to the first chart, But the
getSelection method doesnt seem to return something proper.
Any help would be appreciated. Below is the code im trying to work
on..
Code:
function drawMouseoverVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Time in 24hr Format');
data.addColumn('number','invocations');
data.addRows([
<#list statsList as stat>
['${stat.twentyFourHourtime}',$
{stat.invocations}],
</#list>
]);
barsVisualization = new
google.visualization.ColumnChart(document.getElementById('invocations'));
barsVisualization.draw(data, {width: 800, height: 200, is3D:
true});
//barsVisualization.selected(selectionHandler1());
google.visualization.events.addListener(barsVisualization,'select',selectionHandler1);
}
function selectionHandler1()
{
alert("In Selection Handler1");
var selection = barsVisualization.getSelection();
alert('AFTER In Selection Handler1'+ selection[0]);
//for (var i = 0; i < selection.length; i++) {
var item = selection[0];
if (item.row != null && item.column != null) {
message += '{row:' + item.row + ',column:' + item.column + '}';
} else if (item.row != null) {
message += '{row:' + item.row + '}';
} else if (item.column != null) {
message += '{column:' + item.column + '}';
}
//}
if (message == '') {
message = 'nothing';
}
alert('You selected ' + message);
}
Thanks,
Madhan
--
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.