2013-10-19 4 views
0

이것은 대부분의 사용자에게 지나치게 간단한 질문 일 수 있습니다. 플래시 기반 Google 모션 차트 용 코드가 들어있는 .html 파일을 만들었습니다. 구글의 코드 놀이터 (Code Playground)에 코드를 작성했는데 거기에서 작동하지만 IE, 파이어 폭스 또는 크롬에서 로컬 .html 파일을로드하면 작동하지 않습니다. 나는 구글 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> 

는 당신의 도움에 대해 감사합니다!

최저

, 엘리

답변

1

당신은 차트를 오프라인으로 사용할 수 없습니다.

Can I use charts offline? 

    No; your computer must have live access to http://www.google.com/jsapi in order to use charts. 
This is because the visualization libraries that your page requires are loaded 
dynamically before you use them. The code for loading the appropriate library is part of the 
included jsapi script, and is called when you invoke the google.load() method. Our terms of 
service do not allow you to download the google.load or google.visualization code to use 
offline. 

을하고 또한 언급 한 것 :

여기에 언급 한 바와 같이

Flash-based charts might not work correctly when accessed from a file location in the browser 
(e.g., file:///c:/webhost/myhost/myviz.html) rather than from a web server URL (e.g., http://www.myhost.com/myviz.html). 
This is typically a testing issue only; the issue is not a problem when you access the chart from an http:// address. 
관련 문제