简体   繁体   中英

how to score 100 on google PageSpeed with google charts?

I am trying, to score 100, with google chart, on Google PageSpeed Analyzer , but keep getting "Minifying https://www.google.com/ …at+en,default+en,ui+en,corechart+en.I.js could save 1.7KiB (1% reduction) after compression." how can I get full score on this? TIA Here is my basic sample code:

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></head>
<body><div id="myChart"></div></body></html>

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
    window.onload=function(){pie();}

    google.load('visualization','1.0',{'packages':['corechart']});
    function pie(){
        var data=new google.visualization.DataTable();
        data.addColumn('string','Type');
        data.addColumn('number','Percentage');
        data.addRows([['WE',99],['THEM',1]]);

        var options={'width':500,'height':400,'is3D':true,'chartArea':{left:25,top:25,width:"100%",height:"100%"}};

        var chart=new google.visualization.PieChart(document.getElementById('myChart'));
        chart.draw(data, options);
    }
</script>

Google Page Speed Analyzer is detecting that you have resources that can be minified - in this case your javascript file. Code minification is a simple process. Just run your code through a code minifer - it will eliminate any whitespace that's unnecessary for the code to run properly. Doing this will decrease the file size of the resource, and in turn speed up the user's download.

Take a look at the Google Page Speed Analyzer's docs for suggested code minfiers:

https://developers.google.com/speed/docs/insights/MinifyResources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM