function selectionHandler1()
{
var message="";
var value=0;
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[i];
if (item.row != null && item.column != null) {
// message += '{row:' + item.row + ',column:' + item.column +
'}';
alert("the selected value is in the row:"+item.row+"and
column:"+item.column);
value[i] = data.getValue(item.row,item.column);
alert("You selected the value:"+value[i]);
} 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);
}
This is the code. The getValue function seems to return the data item,
but when i do the above i am unable to see anything returned.
Please help.
Thanks,
Madhan
On Oct 25, 11:43 am, Madhan <[email protected]> wrote:
> Yes, i think that was the mistake.. i got it working now..
>
> but now im trying to get the value in the table that is selected using
> the DataTable.getValue(). That doest seem to work though. It is not
> returning any values.
>
> Please let me know what could be the possible error that i could have
> made ?
>
> Thanks,
> Madhan
>
> On Oct 24, 3:02 am, MC Get Vizzy <[email protected]> wrote:
>
> > At first your code didn't work, so I added the following line to the
> > beginning of the handler function:
>
> > var message = '';
>
> > Then it worked fine. Is it possible that the variable "message" was
> > undeclared in your code?
>
> > Let me know.
>
> > thanks,
>
> > MC Get Vizzy
>
> > On Sat, Oct 23, 2010 at 2:09 AM, Madhan <[email protected]> wrote:
> > > 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]<google-visualization-api%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-visualization-api?hl=en.
--
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.