Wijmo饼图对象参考错误?

时间:2014-04-21 11:38:49

标签: javascript jquery dom charts wijmo

我正在尝试使用wijmo创建一个饼图

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Data Source</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="description" content="%description%" />
    <meta name="keywords" content="" />
    <meta name="author" content="ComponentOne" />

    <link href="../Scripts/Wijmo/jquery-wijmo.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/Wijmo/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../Scripts/Wijmo/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
    <script src="../Scripts/Wijmo/raphael-min.js" type="text/javascript"></script>
    <script src="../Scripts/Wijmo/globalize.min.js" type="text/javascript"></script>
    <script src="../Scripts/Wijmo/jquery.wijmo.raphael.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/Wijmo/jquery.wijmo.wijchartcore.js"></script>
    <script type="text/javascript" src="../Scripts/Wijmo/jquery.wijmo.wijpiechart.js"></script>
    <style type="text/css">
        #wijpiechart
        {
            width: 756px;
            height: 475px;
        }
    </style>
    <script id="scriptInit" type="text/javascript">
        $(document).ready(function () {
            debugger;
            var data = [{
                Device: 'MacBook Pro',
                Percent: 46.78,
                Offset: 15
            }, {
                Device: 'iMac',
                Percent: 23.18
            }, {
                Device: 'MacBook',
                Percent: 20.25
            }, {
                Device: 'Mac Pro',
                Percent: 5.41
            }, {
                Device: 'Mac mini',
                Percent: 3.44
            }];

            $('#wijpiechart').wijpiechart({
                dataSource: data,
                data: {
                    label: { bind: "Device" },
                    value: { bind: "Percent" },
                    offset: { bind: "Offset" }
                },
                radius: 140,
                legend: { visible: true },
                hint: {
                    content: function () {
                        return this.data.label + " : " + Globalize.format(this.value / this.total, "p2");
                    }
                },
                header: {
                    text: "Steam - Mac Hardware"
                }
            });
        });
    </script>
</head>
<body class="demo-single">
    <div class="container">
        <div class="header">
            <h2>
                DataSource</h2>
        </div>
        <div class="main demo">
            <!-- Begin demo markup -->
            <div id="wijpiechart" class="ui-widget ui-widget-content ui-corner-all">
            </div>
            <!-- End demo markup -->
            <div class="demo-options">
                <!-- Begin options markup -->
                <!-- End options markup -->
            </div>
        </div>
        <div class="footer demo-description">
            <p>
                This sample shows how to create a pie chart using an array as the data source for
                the chart.</p>
        </div>
    </div>
</body>
</html>

我收到了对象引用错误/// Microsoft JScript运行时错误:对象不支持此属性或方法

1 个答案:

答案 0 :(得分:1)

您应该引用此链接中提供的完整js文件: http://wijmo.com/downloads/

或者你可以使用AMD模块,可以参考以下链接: http://wijmo.com/docs/wijmo/#AMDwithRequireJs.html