Was easier than i thought, just played with the API and basically come
up with this:
SWAP: message += '{row:' + item.row + ',column:' + item.column + '} =
' + str + '\n';
WITH: message += data.getValue(item.row, 0) + '\n' +
data.getColumnLabel(item.column) + '\nNumber of Calls:' + str + '\n';
Super :D (all this has been to pass the values needed to drill-down in
the data)
Regards
Jordon.
On May 30, 10:22 pm, HeavenCore <[email protected]> wrote:
> Quick Update, the SelectionHandler is now working (example
> here:http://www.heavencore.co.uk/test.htm)
>
> My next task is to replace the column and row indexes in the following
> message with the actual column names and row title (value in the first
> column?)
>
> Replace: "You selected {row:2,column:6} = 13"
> With: "You selected {row:'2009/20',column:'Broadband'} = 13
>
> Any tips on how to modify the following to return the required values?
>
> '############CODE
>
> google.visualization.events.addListener(chart, 'select', function() {
> var selection = chart.getSelection();
> var message = '';
> for (var i = 0; i < selection.length; i++) {
> var item = selection[i];
> if (item.row != null && item.column != null) {
> var str = data.getFormattedValue(item.row, item.column);
> message += '{row:' + item.row + ',column:' + item.column + '} =
> ' + str + '\n';
> } else if (item.row != null) {
> var str = data.getFormattedValue(item.row, 0);
> message += '{row:' + item.row + ', (no column, showing first)} =
> ' + str + '\n';
> } else if (item.column != null) {
> var str = data.getFormattedValue(0, item.column);
> message += '{(no row, showing first), column:' + item.column +
> '} = ' + str + '\n';
> }
> }
> if (message == '') {
> message = 'nothing';
> }
> alert('You selected ' + message);
> });
>
> '############END
>
> On May 29, 5:30 pm, HeavenCore <[email protected]> wrote:
>
>
>
> > Hello there, i have a Stacked Column Chart with quite a lot of data:
>
> >http://www.heavencore.co.uk/viewpage.php?page_id=21
> > (give it a few seconds to load)
>
> > I need to basically add an event on column click that will return
> > values of the column (eg 2009/22), series (eg: Broadband) and value
> > (eg: 3) (basically exactly what the native tooltiup does)
>
> > I have managed to add a listener to alert() the '2009/22' using:
>
> > google.visualization.events.addListener(chart, 'select', function() {
> > var row = chart.getSelection()[0].row;
> > alert('You selected ' + data.getValue(row, 0));
>
> > });
>
> > However, this is not what i want, i understnad i have to deal with
> > rows and columns here, but i am struggling to get the syntax right.
>
> > Please help!
>
> > Many Thanks!
>
> > Jordon- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---