I have this google charts code which works fine: <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" async> google.load("visualization", "1", {packages:["corechart"]}); var t1 = 'IndexTitle' var t2 = 'IndicatorTitle' google.setOnLoadCallback(function(){drawChart1(t1)}); google.setOnLoadCallback(function(){drawChart2(t2)}); function drawChart1(t){ var data = new google.visualization.DataTable(); data.addColumn('string','Date'); data.addColumn('number','Close'); data.addColumn({type: 'string', role: 'tooltip'}); data.addRows([ChartIndexData...........]); var options = { title: t, colors:['black'], legend: {position: 'none'}, chartArea:{left:60,top:20,width:'90%',height:'90%'} }; var chart = new google.visualization.LineChart(document.getElementById('chart1_div')); chart.draw(data, options); } function drawChart2(t){ var data = new google.visualization.DataTable(); data.addColumn('string', 'Date'); data.addColumn('number', ''); data.addColumn({type: 'string', role: 'tooltip'}); data.addRows([ChartIndicatorData...................]); var options = { title: t, legend: {position: 'none'}, chartArea:{left:60,top:20,width:'90%',height:'60%'} }; var chart = new google.visualization.LineChart(document.getElementById('chart2_div')); chart.draw(data, options); }<% </script>
The problem is when I test the page on Google PageSpeed insite the score is 49/100 because of the script above: Remove render-blocking JavaScript:https://www.google.com/jsapi https://www.google.com/…ile=visualization&v=1&packages=corechart https://www.google.com/…at+en,default+en,ui+en,corechart+en.I.js Optimize CSS Delivery of the following: https://www.google.com/…bdd6ab2d343a51d49841bf93d022fb/ui+en.css https://ajax.googleapis.com/…static/modules/gviz/1.0/core/tooltip.css As I understand I have to load javascript Asynchronous or defer the loading. How do I fix it. -- 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.
