我尝试使用graphael site
中的相同代码在我的网站上添加grahael饼图gRaphaël静态饼图
<script src="http://raphaeljs.com/raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="g.raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="g.pie.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
window.onload = function () {
var r = Raphael("holder");
r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
r.g.text(320, 70, "Static Pie Chart").attr({"font-size": 20});
r.g.piechart(320, 240, 150, [55, 20, 13, 32, 5, 1, 2, 10]);
};
</script>
</head>
<body class="raphael" id="g.raphael.dmitry.baranovskiy.com">
<div id="holder"></div>
<p>
Demo of <a href="http://g.raphaeljs.com/">gRaphaël</a> JavaScript library.
</p>
</body>
但我没有得到图表和萤火虫我得到的错误像拉斐尔没有定义?
答案 0 :(得分:2)
<script src="http://raphaeljs.com/raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="g.raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="g.pie.js" type="text/javascript" charset="utf-8"></script>
您正在从远程站点加载一个脚本,而在本地加载其他脚本。你确定你的html文件在同一个文件夹中确实有g.raphael.js
和g.pie.js
吗?