0
對於大多數用戶來說,這可能是一個過於簡單的問題。我創建了一個包含基於Flash的Google Motion Chart代碼的.html文件。我在Google的Code Playground中編寫了代碼,它在那裏工作,但在IE,Firefox或Chrome中加載本地.html文件時無法工作。我知道Google here提出的解決方案,但這並不適用於我。爲什麼我的基於Flash的圖表無法從本地文件運行?
我的代碼粘貼下面:
<!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', {packages: ['motionchart']});
</script>
<script type="text/javascript">
var visualization;
function drawVisualization() {
// To see the data that this visualization uses, browse to
// http://spreadsheets.google.com/ccc?key=pCQbetd-CptGXxxQIG7VFIQ
var query = new google.visualization.Query(
'https://docs.google.com/spreadsheet/pub?key=0AjjzMkj-NxM0dEdFRWtYWTh6VDRlNGZfRThZN3BVZFE&single=true&gid=0&output=csv');
// Send the query with a callback function.
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
visualization = new google.visualization.MotionChart(document.getElementById('visualization'));
//visualization.draw(data, {'width': 800, 'height': 400});
var options = {};
options['state'] =
'{"xZoomedDataMin":631152000000,"colorOption":"3","playDuration":15000,"xZoomedIn":false, \
"sizeOption":"_UNISIZE","duration":{"timeUnit":"Y","multiplier":1}, \
"uniColorForNonSelected":false,"orderedByY":false,"yAxisOption":"3", \
"xZoomedDataMax":1230768000000,"yLambda":1,"iconType":"BUBBLE","yZoomedIn":false, \
"xLambda":1,"orderedByX":false,"yZoomedDataMin":63.16,"nonSelectedAlpha":0.3, \
"yZoomedDataMax":87.79,"xAxisOption":"_TIME","iconKeySettings":[],"time":"1990", \
"dimensions":{"iconDimensions":["dim0"]},"showTrails":true};';
options['width'] = 900;
options['height'] = 400;
visualization.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization" style="height: 400px; width: 400px;"></div>
</body>
</html>
謝謝大家的幫助!
最佳, 禮