2

我尝试使用来自 graphael 网站的相同代码在我的网站中添加 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>

但是我没有得到图表并且在萤火虫上我得到了像 Raphael 没有定义的错误?

4

1 回答 1

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>

您正在从远程站点加载一个脚本,而在本地加载其他脚本。你确定你真的g.raphael.jsg.pie.js你的html文件在同一个文件夹中吗?

于 2011-04-14T07:26:20.107 回答