The easiest way I found to manage using the same event listener function 
for multiple charts is to put the charts in an array and loop over the 
array, assigning an event listener for each chart:

// charts is an array of charts
for (var i = 0; i < charts.length; i++) {
    google.visualization.events.addListener(charts[i], 'ready', (function (x
) {
        return function () {
            // use charts[x] to access the specific chart
        }
    })(i);
} 

Note that you need to use a closure around the function to map each 
instance of "i" to the handler function for that chart.

On Monday, July 9, 2012 10:54:39 AM UTC-4, Ricardo Coelho wrote:
>
> Hi, 
> First, sorry for my english. 
>
> I understand how to use "addListener" but in every examples i found, 
> it is with one chart. 
> How can I do with many chart ? how can i know which one as been 
> clicked ? 
>
> So i can't use "getSelection". I need to use the same callback 
> function for every chart. 
>
> Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/J3tTV-6HxrIJ.
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