AddListener Select Event Not Working on iPhone

141 views
Skip to first unread message

Jimmy Genslinger

unread,
Feb 18, 2014, 8:19:22 AM2/18/14
to google-visua...@googlegroups.com
Hello,

  I've developed a web site that uses a lot of Google Charts, the link to the site is: https://assessment.jefferson.kyschools.us/DMA/SPV/SPV.aspx

  If you drill down through Goal 1, Success Measure 1, you can see one of the charts.  If you click on any of the bars in the chart, it will open up a new window with supporting detail.  This works great on desktop/laptop environments, but on an iPhone, the Select event is not firing...it just highlights the bar and the pop up label displays.  Am I doing something wrong? Is there a different coding method needed to make it work on iPhones?  My code snippet is below:

            chrt = new google.visualization.ColumnChart(document.getElementById('divFA1SM1'));

            function selectHandler() {
                var selectedItem = chrt.getSelection()[0];
                if (selectedItem) {
                    var topping = data.getValue(selectedItem.row, 0);

                    switch (topping) {
                        case 'Elementary':
                            window.open('FA1SM1.aspx?schoolLevel=1', 'SubReport', 'width=625,height=750');
                            break;
                        case 'Middle':
                            window.open('FA1SM1.aspx?schoolLevel=2', 'SubReport', 'width=625,height=750');
                            break;
                        case 'High':
                            window.open('FA1SM1.aspx?schoolLevel=3', 'SubReport', 'width=625,height=750');
                            break;
                    }
                }
            }

            google.visualization.events.addListener(chrt, 'select', selectHandler);
            chrt.draw(dview, options);

asgallant

unread,
Feb 18, 2014, 12:34:30 PM2/18/14
to google-visua...@googlegroups.com
The Visualization API does not have good support for touch events.  From your description, I suspect that the browser is treating the tap as a mouseover, not a click.  You can map touch events to mouse events, which I have heard works for fixing these kinds of problems.  There is a good post on StackOverflow with an example: http://stackoverflow.com/a/1781750/613559
Message has been deleted

Jimmy Genslinger

unread,
Feb 18, 2014, 12:50:55 PM2/18/14
to google-visua...@googlegroups.com
You hit the nail on the head...it appears to be a Safari issue...I just tried using Chrome on iPhone and it worked perfectly.  I will check out the link you suggested and see if that will help...but thanks for giving me something to think about!!
Reply all
Reply to author
Forward
0 new messages