Are you loading it from a webserver or from your file system? If it's not on a webserver, you need to add the protocol to the jsapi script URL:
<script type="text/javascript" src="http://www.google.com/jsapi"></script> If you leave out the protocol, the browser uses whatever protocol the page uses (so if the page is hosted on http, the script will load from "http://"; if the page is on https, the script will load from "https://"; this is done to allow script tags to work equally well on secure and non-secure pages). When loading from your local file system, the browser will try to load from "file://", which will fail. On Monday, June 30, 2014 5:24:54 AM UTC-4, Patrick wrote: > > Dear developers. > > I have a script which work on : > https://code.google.com/apis/ajax/playground/?type=visualization#full_dashboard > > (tab Edit HTML). > > > > <!-- > You are free to copy and use this sample in accordance with the terms of > the > Apache license (http://www.apache.org/licenses/LICENSE-2.0.html) > --> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/> > <title> > Google Visualization API Sample > </title> > <script type="text/javascript" src="//www.google.com/jsapi"></script> > <script type="text/javascript"> > google.load('visualization', '1.1', {packages: ['controls']}); > </script> > <script type="text/javascript"> > function drawVisualization() { > // Prepare the data > var data = google.visualization.arrayToDataTable([ > ['s1', 's2'], > ['x1' , 100], > ['x2' , 100], > ]); > > > > > var pie = new google.visualization.ChartWrapper({ > 'chartType': 'PieChart', > 'containerId': 'chart1', > dataTable: data, > 'options': { > 'width': 300, > 'height': 300, > 'legend': 'none', > 'title': 'Pie chart', > 'chartArea': {'left': 15, 'top': 15, 'right': 0, 'bottom': 0 > }, > 'pieSliceText': 'label' > }, > // Instruct the piechart to use colums 0 () and 1 () > // from the 'data' DataTable. > 'view': {'columns': [0, 1]} > }); > pie.draw(); > > // Define a table > var table = new google.visualization.ChartWrapper({ > 'chartType': 'Table', > 'containerId': 'chart2', > dataTable: data, > 'options': { > 'width': '300px' > } > }); > table.draw(); > > > } > > > google.setOnLoadCallback(drawVisualization); > </script> > </head> > <body style="font-family: Arial;border: 0 none;"> > <div id="dashboard"> > <table> > <tr style='vertical-align: top'> > <td style='width: 300px; font-size: 0.9em;'> > > </td> > <td style='width: 600px'> > <div style="float: left;" id="chart1"></div> > <div style="float: left;" id="chart2"></div> > > </td> > </tr> > </table> > </div> > </body> > </html> > > > > But When I copy it in an HTML file. It doesn't work (blank page). > > Any solution ? > > Thanks ! > -- 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.
