谷歌图表会短暂显示然后消失

时间:2015-08-20 00:45:50

标签: javascript html json google-visualization

我附上了我的HTML代码。昨天和过去8个月一切正常。我知道谷歌已经在8月17日更新了图表,但根据这些更新无法找到任何内容。

当您第一次连接到页面但是消失时,图表会短暂显示。这个问题正在影响我的Apple,Ubuntu,Windows笔记本电脑和台式机指向Web界限。

    <head> 


    <script type="text/javascript" src="https://www.google.com/jsapi"></script> 

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
     <script type="text/javascript"> 


// Load the Visualization API and the piechart package. 

google.load('visualization', '1', {'packages':['corechart']}); 

// Set a callback to run when the Google Visualization API is loaded. 

google.setOnLoadCallback(drawChart); 


function drawChart() { 

var json = $.ajax({ 

url: "get_json.php", // make this url point to the data file 

dataType: "json", 

async: false 

}).responseText; 


// Create our data table out of JSON data loaded from server. 

var data = new google.visualization.DataTable(json); 

var options = { 

title: 'TODAYS  CHART ', 

legend: { position: 'bottom' }, 

colors: ['blue', 'green', 'red'], 

is3D: 'true', 

fontSize: 16, 

fontName: 'Telex', 

vAxis: {title: "Usage",titleTextStyle:{ fontName: 'Yanone Kaffeesatz', bold: true , italic: false, fontSize: 16, color:'#666666'}, gridlines:{count: 15}}, 

hAxis: {title: "Easter Standard Time", format: '', titleTextStyle:{ fontName: 'Yanone Kaffeesatz', bold: true , italic: false, fontSize: 16, color:'#666666'}, slantedText:true, slantedTextAngle:45, gridlines:{count: 24}}, 

width:1100, 

height: 500, 

pointSize: 7, 


}; 

// Instantiate and draw our chart, passing in some options. 

//do not forget to check ur div ID 

var chart = new google.visualization.LineChart(document.getElementById('chart_div')); 

chart.draw(data, options); 



setInterval(drawChart, 500 ); 

} 


    </script> 



    <link rel="stylesheet" type="text/css" href="/css/result-light.css"> 

    <link href="page_css/......"> 

    <style type="text/css"> 


.current_container 
{ 
            float:left; position: relative; margin-left: 35px; width: 1100px; top: 10px; height: 400px; text-align:center;
}


     </style>

     </head>

      <body>


     <div class="current_container">
        <div id="chart_div" style="width: 900px; height: 650px; position: inherit; float: none"></div>

     </div>

     </body>
    </html>

0 个答案:

没有答案