Geochart: Problem in iOS

516 views
Skip to first unread message

Carlos Moreira

unread,
Apr 7, 2014, 12:34:45 PM4/7/14
to google-visua...@googlegroups.com
Hi guys
Not sure this is an API problem, or a javascript problem.
I've got this code that works very well everywhere except on iOS devices:

I have objects with the map data and then I build the map according to that data. 
I've modified the code a bit for example purposes, so there might be unecessary code. 
But I guess the important code is the getSelection one:

google.visualization.events.addListener(geocharts[key], 'select', (function(x) {
             return function () {

                var selection = geocharts[x].getSelection();
                
                if (selection.length == 1) {
                    
                    var selectedRow = selection[0].row;
                    var selectedRegion = data[x].getValue(selectedRow, 0);
                    
                    //console.log(values[x][selectedRegion]);
                    
                    if(values[x][selectedRegion]!=""){
                   
                    alert(values[x][selectedRegion]);
                       
                    
                    }
                }
            }
        })(key));



This doesn't seem to be working in iOS. 
Any advice on what I could be doing wrong? 

Thanks in advanced! 
Greetings, Carlos

asgallant

unread,
Apr 7, 2014, 1:53:35 PM4/7/14
to google-visua...@googlegroups.com
Likely this is an issue with touch events.  As I understand it, some mobile browsers send click events whenever a comparable touch event fires, but Safari on iOS doesn't.  You need to emulate mouse events from touch events in iOS.  There is a post over on StackOverflow that should get you started: http://stackoverflow.com/a/1781750/613559

Carlos Moreira

unread,
May 19, 2014, 8:28:41 PM5/19/14
to google-visua...@googlegroups.com
Thank you for the fast reply asgallant! 

I tried doing the touch events mapping, but I had no success. 
After some hours wasted with this I narrowed it down to a conflict with the use of html tooltips

tooltip: {isHtml: false} = Select Listener will work. > http://jsfiddle.net/cmoreira/LFrdP/
tooltip: {isHtml: true} = Select Listener will NOT work in iOS > http://jsfiddle.net/cmoreira/NBMs5/

I guess this is a bug in the API, what do you think?

This is only an issue on iOS devices, like iPhone and iPad. 

Tried with 1.1 and still the same issue. 
Someone from the Google team can confirm this bug? Sergey? 

Cheers

Jeremy Faller

unread,
May 29, 2014, 2:31:31 PM5/29/14
to google-visua...@googlegroups.com
I spent a marginal amount of time looking at this, and it appears to me that it works. In other words, I am seeing the HTML tooltip in iOS 7.1 on America.

Are you running an older version of iOS? Is this not what I should be seeing?

Any more data you can provide, and I'll try to help get to the bottom of the problem.

Carlos Moreira

unread,
May 29, 2014, 8:38:36 PM5/29/14
to google-visua...@googlegroups.com
Hi Jeremy, thank you for looking into it.
The issue is not with the html tooltip, that works fine, but with the select listener. 
Clicking the countries with data an alert message should fire, and on iOS it seems it does not. 
Do you confirm this behaviour on iOS 7.1 also? Or does the alert message works properly for you? 
I'm not on the latest version of iOS, but tested in different browsers, none seemed to work. Works fine on Android. 
Also added an issue entry here were were someone provided more info: https://code.google.com/p/google-visualization-api-issues/issues/detail?id=1597

Jeremy Faller

unread,
Jun 4, 2014, 9:48:33 AM6/4/14
to google-visua...@googlegroups.com
You're right, iOS 7.1 doesn't fire the alert.

I suspect you'd have problems getting Drew's solution working for you. There's subtlety (read:crap) in our event routing would likely make it difficult to make it work. I will speak with the Geo engineer about this, and likely file some bugs on our end.

Carlos Moreira

unread,
Dec 16, 2014, 7:51:46 AM12/16/14
to google-visua...@googlegroups.com
Hi

Any update on this? 
Cheers

Johannes Rainer

unread,
Aug 21, 2015, 4:50:59 AM8/21/15
to Google Visualization API
 I am having the same problem.

Carlos Moreira

unread,
Aug 12, 2016, 4:04:56 PM8/12/16
to Google Visualization API
Hi
Seems this issue exists after more than one year and several updates on Safari and iOS. 
Is there any workaround we can implement to have the HTML tooltips with the select event working on iOS devices?

Carlos Moreira

unread,
May 7, 2018, 10:50:46 AM5/7/18
to Google Visualization API
Hi guys
Here I am again after a few years.. The problem still occurs on the latest versions of the API and iOS. 
Is there really nothing we can do? 

'regionClick' and 'select' event, none of them fires on iOS when html tooltips are enabled. 
Reply all
Reply to author
Forward
0 new messages