Thank Andrew Gallant. I will use selection [0].Fb until the name of the 
attribute to be set.

Em quinta-feira, 19 de junho de 2014 13h16min14s UTC-3, Andrew Gallant 
escreveu:
>
> You found a bug.  The "row" property is obfuscated as "Fb", so use that 
> temporarily until the bug gets fixed (eg: selection[0].Fb).  I filed a 
> bug report on this here 
> <https://code.google.com/p/google-visualization-api-issues/issues/detail?id=1627>.
>   
> You can "star" the bug report to get updates on progress on the fix.  If 
> the developers push a new version up before the bug is fixed, the 
> obfuscated name is likely to change to something else.  If it stops 
> working, add the line console.log(selection[0]) to the if statement, view 
> the page in Chrome, and check the developer's console after selecting 
> something.  There should be an object printed there that you can check for 
> the obfuscated properties: one with a number value (this is the row index) 
> and one that is null (this would be the column index, if selecting a column 
> in a Timeline had any meaning).
>
> On Thursday, June 19, 2014 11:16:42 AM UTC-4, JProject wrote:
>>
>> Andrew Gallant, thanks for the reply.  Yet selection[0].row is returning 
>> undefined. Below is a complete example of the behavior that line of code. 
>> My goal is to get the selected element in the timeline, but I'm not 
>> having success.
>>
>> <html>
>> <head>
>> <script type="text/javascript" src="
>> https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization
>> ',
>>    'version':'1','packages':['timeline']}]}">
>> </script>
>> <script type="text/javascript">
>> google.setOnLoadCallback(drawChart);
>>
>> function drawChart() {
>>   var container = document.getElementById('example1');
>>
>>   var chart = new google.visualization.Timeline(container);
>>
>>   var dataTable = new google.visualization.DataTable();
>>
>>   dataTable.addColumn({ type: 'string', id: 'President' });
>>   dataTable.addColumn({ type: 'date', id: 'Start' });
>>   dataTable.addColumn({ type: 'date', id: 'End' });
>>
>>   dataTable.addRows([
>> [ 'Washington', new Date(1789, 3, 29), new Date(1797, 2, 3) ],
>> [ 'Adams',      new Date(1797, 2, 3),  new Date(1801, 2, 3) ],
>> [ 'Jefferson',  new Date(1801, 2, 3),  new Date(1809, 2, 3) ]]);
>>  
>>  chart.draw(dataTable);
>>  
>>  google.visualization.events.addListener(chart, 'select', function(){
>> var selection = chart.getSelection();
>> if (selection.length) {
>> alert("Row: "+selection[0].row);
>> alert("Length: "+selection.length);
>> }else{
>> alert("2 - Length: "+selection.length);
>> }
>>  });
>> }
>> </script>
>>
>> </head>
>> <body>
>> <div id="example1" style="width: 900px; height: 180px;"></div>
>> </body>
>>
>> </html>
>>
>>
>>
>>
>>
>>
>>
>>
>> Em quarta-feira, 18 de junho de 2014 15h52min14s UTC-3, JProject escreveu:
>>>
>>> Hello, I want to capture the selected element in my timeline, but 
>>> chart.getSelection () [0]. Returns undefined. 
>>>
>>> var container = document.getElementById('timeline');
>>> chartTimeLine = new google.visualization.Timeline(container);
>>> dataTimeLine = new google.visualization.DataTable();
>>>  dataTimeLine.addColumn({ type: 'string', id: 'President' });
>>> dataTimeLine.addColumn({ type: 'date', id: 'Start' });
>>> dataTimeLine.addColumn({ type: 'date', id: 'End' });
>>>
>>> dataTimeLine.addRows([
>>> [ 'Washington', new Date(1789, 3, 29), new Date(1797, 2, 3) ],
>>> [ 'Jefferson',  new Date(1801, 2, 3),  new Date(1809, 2, 3) ]]);
>>> chartTimeLine.draw(dataTimeLine);
>>> google.visualization.events.addListener(chartTimeLine, 'select', 
>>> timeLineSelected);
>>>
>>>                function timeLineSelected(){
>>>               alert(chartTimeLine.getSelection()[0].row);
>>>                }
>>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to