Google chart is not working in safari

1,114 views
Skip to first unread message

Ankit Kumar

unread,
Dec 13, 2016, 11:13:58 PM12/13/16
to Google Visualization API

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
    google.charts.load('current', { packages: ['corechart', 'bar'] });
    google.charts.setOnLoadCallback(drawBasic);

    function drawBasic() {

        var data = google.visualization.arrayToDataTable([
          ['City', '2010 Population', ],
          ['New York City, NY', 8175000],
          ['Los Angeles, CA', 3792000],
          ['Chicago, IL', 2695000],
          ['Houston, TX', 2099000],
          ['Philadelphia, PA', 1526000]
        ]);
        var data = google.visualization.arrayToDataTable([
         ['Element', 'Density', { role: 'style' }, { role: 'annotation' }],
         ['New York City, NY', 21.45, '#8EC760', 'RM 12.21'],            // RGB value
         ['Chicago, IL', 20.45, '#DF5A51', 'RM 9.25'],            // English color name
         ['Houston, TX', 15.30, '#FECC39',''],
         ['Philadelphia, PA', 10.49, '#45CBFE',''],// CSS-style declaration
          ['Philadelphia, PB',8.94, '#FF7E00',''],
        ]);
        var options = {
           
            hAxis: {
                textPosition: 'none', gridlines: {
                    color: 'transparent'
                }
            },
            vAxis: {
                textPosition: 'none'
            },
            legend: { position: 'none' },
            'tooltip': {
                trigger: 'none'
            }
            //title: 'Population of Largest U.S. Cities',
            //chartArea: { width: '50%' },
            //hAxis: {
            //    title: 'Total Population',
            //    minValue: 0
            //},
            //vAxis: {
            //    title: 'City'
            //},
            
        };
        

        var chart = new google.visualization.BarChart(document.getElementById('custRunnwise'));

        chart.draw(data, options);
        $(window).resize(function () {
            chart.draw(data, options);
        });
    }

Daniel LaLiberte

unread,
Dec 14, 2016, 9:47:18 AM12/14/16
to Google Visualization API
Hi Ankit,

I notice you have an extra comma after the last element of your second data array.  This will leave an undefined value which will likely cause an error.  Some browsers may ignore it, but I am not sure what Safari does these days.  Try to remove it and see what happens.  


Otherwise, it would be helpful to know more about what "not working" means.  Is there a JS console error message?  Can you simplify the code to narrow down where the problem is?

--
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 google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/3846bcdc-f0c9-4880-a92f-ce736cff3343%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jaswant Singh

unread,
Jun 6, 2019, 2:23:06 AM6/6/19
to Google Visualization API
Well.. I also find same issue.. here you can see : 


even chart samples do not work on safari.
To post to this group, send email to google-visua...@googlegroups.com.



--

Daniel LaLiberte

unread,
Jun 6, 2019, 11:01:32 AM6/6/19
to Google Visualization API

Hi Jaswant,

The area chart documentation page is working fine for me in Safari, at least version 12.1.1, on a macbook.  Which version are you using?

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.



--

--
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 google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages