未捕获的TypeError:$(...)。kendoChart不是函数我应该怎么做

时间:2019-03-26 08:04:04

标签: kendo-ui

我想在kendoui中使用图表组件,但是在使用它的过程中遇到了以下问题,该问题提示我$(...)。kendoChart不是函数。我已经介绍了所需的js,我想知道应该怎么做,这是我的代码

<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="${base.contextPath}/lib/kendoui/js/jquery.min.js"></script>
    <script src="${base.contextPath}/lib/kendoui/js/kendo.all.min.js"></script>
</head>
<body>
<style>

</style>
    <div class="row" id="exmple">
        <div class="demo-section k-content wide">
            <div id="chart"></div>
        </div>
    </div>
<script>
        var data = [
            {
                "source": "Hydro",
                "percentage": 22,
                "explode": true
            },
            {
                "source": "Solar",
                "percentage": 2
            },
            {
                "source": "Nuclear",
                "percentage": 49
            },
            {
                "source": "Wind",
                "percentage": 27
            }
        ];

        function createChart() {
            $("#chart").kendoChart({
                title: {
                    text: "Break-up of Spain Electricity Production for 2008"
                },
                legend: {
                    position: "bottom"
                },
                dataSource: {
                    data: data
                },
                series: [{
                    type: "pie",
                    field: "percentage",
                    categoryField: "source",
                    explodeField: "explode"
                }],
                seriesColors: ["#03a9f4", "#ff9800", "#fad84a", "#4caf50"]
            });
        }

        $(document).ready(createChart);
        $(document).bind("kendo:skinChange", createChart);
    </script>
</body>

未捕获的TypeError:$(...)。kendoChart不是函数

1 个答案:

答案 0 :(得分:1)

该问题是由图表必需的kendo库(kendo.dataviz.min.js)丢失引起的。除非按照论坛帖子中的说明购买产品,否则该文件似乎不可用: