Thanks. That's is working perfect! :D
El martes, 21 de mayo de 2013 17:07:11 UTC+2, asgallant escribió:
>
> That happens when there are no selected elements (you are trying to access
> the first element of an array with 0 elements). The select event fires
> when an element is selected and when it is deselected, so you have to test
> for the length of the array:
>
> var selection = Chart.getSelection();
> if (selection.length > 0) {
> var name = dataTable.getValue(selection[0].row, 3);
> // do something with name
> }
> else {
> // go to a state appropriate for having no selected elements
> }
>
> On Tuesday, May 21, 2013 10:48:38 AM UTC-4, John wrote:
>>
>>
>> 1. The message is:
>>
>> Uncaught TypeError: Cannot read property '0' of undefined
>>
>> Any idea?
>> Thanks!
>>
>> El martes, 21 de mayo de 2013 15:34:48 UTC+2, asgallant escribió:
>>>
>>> Open it in Chrome, view the developers console (ctrl+shift+j to open),
>>> and select something in the chart - what error messages appear in the
>>> console?
>>>
>>> On Tuesday, May 21, 2013 2:58:48 AM UTC-4, John wrote:
>>>>
>>>> Thanks for help me, buI tried that and I will not.
>>>> I assume that the user will select one just because they can make more
>>>> selections at a time.
>>>> The first line if it works (var selection = Chart.getSelection();),
>>>> but the second is not.(var name = dataTable.getValue(selection[0].row, 3);)
>>>> It freezes the chart and unresponsive to new interactions.
>>>>
>>>>
>>>>
>>>>
>>>> El lunes, 20 de mayo de 2013 18:49:19 UTC+2, asgallant escribió:
>>>>>
>>>>> The selection object is typically an array, which potentially contains
>>>>> multiple selected data points. If you are assuming that your users are
>>>>> only selecting one point (or the chart doesn't support multiple
>>>>> selections), then this is what you would do:
>>>>>
>>>>> var selection = Chart.getSelection();
>>>>> var name = dataTable.getValue(selection[0].row, 3);
>>>>>
>>>>> On Monday, May 20, 2013 12:13:11 PM UTC-4, John wrote:
>>>>>>
>>>>>> How I can get the name of the tooltip.
>>>>>> I'm using the event 'select' and the function getSelection and
>>>>>> getValue, but the line getValue not work fine. I trie with several types
>>>>>> code and I couldn't get the name.
>>>>>>
>>>>>> The code is:
>>>>>>
>>>>>> var selection = Chart.getSelection();
>>>>>> var name =
>>>>>> dataTable.getValue(selection.row[0],selection.column[3]);
>>>>>>
>>>>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.