I think you are attaching the 'ready' listener to the wrong object. Your
line reads:

google.visualization.events.addListener(*visualization*, 'ready', onReady);

But I'm not sure what 'visualization' points to. Instead you should attach
the listener to the dashboard, and for this you have to assign the
google.visualization.Dashboard instance to an object.

var *dashboard* =
new google.visualization.Dashboard(document.getElementById('dashboard'));
dashboard.bind(CyPicker, [TmPicker, NrPicker, TrPicker]).
               bind(TmPicker, [map1, table1, chart1]).
               draw(data);

google.visualization.events.addListener(*dashboard*, 'ready', onReady);
function onReady(...) {
  ...
}

The above code reads: when the dashboard is ready (aka, it has completed
drawing at least once and hence all the controls and charts part of it are
guaranteed to exist), then you attach selection handlers.

Does it make sense?
-- R.

On 23 September 2011 00:27, Onno Benschop <[email protected]> wrote:

> That worked a treat.
>
> The code now looks like this:
>
>        new
> google.visualization.Dashboard(document.getElementById('dashboard')).
>                bind(CyPicker, [TmPicker, NrPicker, TrPicker]).
>                bind(TmPicker, [map1, table1, chart1]).
>                draw(data);
>
>        google.visualization.events.addListener(table1, 'select', function()
> { map1.getChart().setSelection(table1.getChart().getSelection()); });
>        google.visualization.events.addListener(map1, 'select', function()
> { table1.getChart().setSelection(map1.getChart().getSelection()); });
>
>
>
> While investigating I did some experimentation with the 'ready'
> listener for the Dashboard, but that didn't work as expected (I got an
> error about a being null). I came across the documentation that said
> that I should use this method because there was no guarantee that the
> listener could be added if the Dashboard wasn't ready. The document is
> here:
>
>
> http://code.google.com/apis/chart/interactive/docs/reference.html#chartwrapperobject
>
> The actual error I got was:
> Error: a is undefined
> Source File:
>
> http://www.google.com/uds/api/visualization/1.0/cd9282b3113b5d80b6043070ddbc00e4/default,map,controls,table,corechart.I.js
> Line: 282
>
> The code that generated that error was:
>         new
> google.visualization.Dashboard(document.getElementById('dashboard')).
>                bind(CyPicker, [TmPicker, NrPicker, TrPicker]).
>                bind(TmPicker, [map1, table1, chart1]).
>                draw(data);
>
>         google.visualization.events.addListener(visualization, 'ready',
> onReady);
>
>        function onReady() {
>                google.visualization.events.addListener(table1, 'select',
> function()
> { map1.getChart().setSelection(table1.getChart().getSelection()); });
>                google.visualization.events.addListener(map1, 'select',
> function()
> { table1.getChart().setSelection(map1.getChart().getSelection()); });
>        }
>
> Note that I also tried with a different variable scope, I defined both
> map1 and table1 in the global scope, unlike in the working code at the
> beginning of this message where the scope of map1 and table1 are
> within my handleQueryResponse() handler.
>
> --
> 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.
>
>

-- 
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.

Reply via email to