Google将此文件用于Google可视化的位置在哪里,我可以将其设置在我的网站本地吗?此外,任何代码来获取仪表在IE中工作的例子? [英] Where does Google keep this file used for Google Visualization can I make it local to my site? Also, any examples of code to get gauges to work in IE?

查看:255
本文介绍了Google将此文件用于Google可视化的位置在哪里,我可以将其设置在我的网站本地吗?此外,任何代码来获取仪表在IE中工作的例子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑

请在此处查看生成的html和Javascript:

http://jsfiddle.net/GregMcNulty/K6Vrb/1/

据此评论4 - 评论在开头 导致问题。



我的问题是,哪个文件是这个文件以及何时被加载?

我加载的唯一文件是: https:// www .google.com / jsapi ,如示例中所示



因此,如果我能弄清楚什么时候以及如何调用它,我可以在我的网站上创建一个本地文件,而不是从谷歌中调用它。它删除评论,所以我可以让谷歌仪表在IE中工作?



谢谢。

不确定为什么把元数据放在脑海中对我来说也不适合?应该在所有情况下工作吗?

任何人都有一个具体的例子,他们可以展示他们如何得到谷歌可视化/图表与IE浏览器工作?



头部没有任何文档类型,但是它会将其余的文本(未显示)非常渲染...

 < html> 
< head>< meta http-equiv =X-UA-Compatiblecontent =IE = EmulateIE7/>
< title>
您的关卡
< / title>

<! - Google JavaScript测量仪 - >
< script src ='http://www.google.com/jsapi'type ='text / javascript'>< / script>
<! - 样式表 - >
< link href =Styles / EliteCircle.css =stylesheettype =text / css/>
<! - 我的本地JavaScript文件 - >
< script src =Scripts / JScript.jstype =text / javascript>< / script>



< / head>


< body>

< form name =aspnetFormmethod =postaction =Stats.aspxonsubmit =javascript:return WebForm_OnSubmit(); ID = aspnetForm >

...等...

解决方案

解决方案很简单。



注释中的DOCTYPE是 网页中的DOCTYPE 。一个叫做Google Visualization的javascript。



证明:


  1. Gauge example on Google Visualization page。

  2. 将它剪切并粘贴到桌面上的g.html文件中

  3. do not
  4. em>添加任何DTD <!DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1
  5. 在IE8中打开它=>作品

  6. 添加3中显示的DTD =>断开。

因此,基本上,为了使其工作,在IE8中,在 html 开始标记。



我试过其他的DTD,尤其是xhtml 1 strict,没有运气。

更新



顺便说一下,由visual studio(古董4.01)插入的dtd仍然有效。
我也添加了标题。下面的文件适用于IE8。

 <!DOCTYPE HTML PUBLIC -  // W3C // DTD HTML 4.0过渡// EN> 
< html>
< head>
< meta http-equiv =X-UA-Compatiblecontent =IE = EmulateIE7/>
< title>
您的关卡
< / title>
<! - 样式表 - >
< link href =Styles / EliteCircle.css =stylesheettype =text / css/>
<! - 我的本地JavaScript文件 - >
< script src =Scripts / JScript.jstype =text / javascript>< / script>
< script type ='text / javascript'src ='https://www.google.com/jsapi'>< / script>
< script type ='text / javascript'>
google.load('visualization','1',{packages:['gauge']});
google.setOnLoadCallback(drawChart);
函数drawChart(){
var data = new google.visualization.DataTable();
data.addColumn('string','Label');
data.addColumn('number','Value');
data.addRows(3);
data.setValue(0,0,'Memory');
data.setValue(0,1,80);
data.setValue(1,0,'CPU');
data.setValue(1,1,55);
data.setValue(2,0,'Network');
data.setValue(2,1,68);

var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
var options = {width:400,height:120,redFrom:90,redTo:100,
yellowFrom:75,yellowTo:90,minorTicks:5
};
chart.draw(data,options);
}
< / script>
< / head>
< body>
< div id ='chart_div'>< / div>
< form name =aspnetFormmethod =postaction =Stats.aspxonsubmit =javascript:return WebForm_OnSubmit(); ID = aspnetForm >
< / form>
< / body>
< / html>


EDIT
Please see the produced html and Javascript here:
http://jsfiddle.net/GregMcNulty/K6Vrb/1/

According to this Comment 4 - the comment at the beginning of the file is causing issues.

My question is, which file is this and when does it get loaded?

The only file I load is: https://www.google.com/jsapi as shown in the example.

So if I can figure out when and how it is called, can I make this a local file on my site instead of calling it from google.... and edit it to remove the comments, so i can get the google gauges to work in IE?

Thanks.

Not sure why putting the meta data in the head is not working for me either? Should that work in all cases?

Anyone have a specific example they can show how they got the google visualization/charts working with IE?

The head without any doc type, however, it renders the rest of the body (not shown) terribly...

<html>
<head><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />  
<title>
    Your Levels
</title>

     <!-- Google JavaScript for gauges -->
       <script src='http://www.google.com/jsapi' type='text/javascript' ></script>   
    <!-- Style Sheet -->
       <link href="Styles/EliteCircle.css" rel="stylesheet" type="text/css" />    
    <!-- My local JavaScript File -->
       <script src="Scripts/JScript.js" type="text/javascript"></script>



</head>


<body>

    <form name="aspnetForm" method="post" action="Stats.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">  

...etc...

解决方案

The solution is easy.

The DOCTYPE in the comment is the DOCTYPE in your web page. The one that calls the Google Visualization javascript.

Proof:

  1. Take the Gauge example on the Google Visualization page.
  2. Cut and paste it in a file g.html on your desktop
  3. do not add any DTD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> on top of the HTML tag.
  4. Open it in IE8 => works
  5. add the DTD shown in 3 => broken.

So basically, to make it work, in IE8, omit the DTD before the html opening tag.

I've tried other DTDs, especially the xhtml 1 strict, known to make IE behave. No luck yet.

Update

By the way, when I add the dtd inserted by visual studio (antique 4.01) it still works. I've also added your header. The file below works fine in IE8 for me.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>
    Your Levels
</title>
     <!-- Style Sheet -->
       <link href="Styles/EliteCircle.css" rel="stylesheet" type="text/css" />    
    <!-- My local JavaScript File -->
       <script src="Scripts/JScript.js" type="text/javascript"></script>
    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
    <script type='text/javascript'>
        google.load('visualization', '1', { packages: ['gauge'] });
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Label');
            data.addColumn('number', 'Value');
            data.addRows(3);
            data.setValue(0, 0, 'Memory');
            data.setValue(0, 1, 80);
            data.setValue(1, 0, 'CPU');
            data.setValue(1, 1, 55);
            data.setValue(2, 0, 'Network');
            data.setValue(2, 1, 68);

            var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
            var options = { width: 400, height: 120, redFrom: 90, redTo: 100,
                yellowFrom: 75, yellowTo: 90, minorTicks: 5
            };
            chart.draw(data, options);
        }
    </script>
  </head>
  <body>
    <div id='chart_div'></div>
       <form name="aspnetForm" method="post" action="Stats.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">  
       </form>
  </body>
</html>

这篇关于Google将此文件用于Google可视化的位置在哪里,我可以将其设置在我的网站本地吗?此外,任何代码来获取仪表在IE中工作的例子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆