Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Angular在本地绑定DataViz图表_Javascript_Angularjs_Kendo Ui_Kendo Dataviz - Fatal编程技术网

Javascript 使用Angular在本地绑定DataViz图表

Javascript 使用Angular在本地绑定DataViz图表,javascript,angularjs,kendo-ui,kendo-dataviz,Javascript,Angularjs,Kendo Ui,Kendo Dataviz,我试图使用Kendo UI Angular指令在本地绑定DataViz饼图,但不断出现以下错误: TypeError: Cannot call method 'toLowerCase' of undefined at h (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:5351) at Object.o.aggregate (http://localhost:51717/Scripts/kendo/ken

我试图使用Kendo UI Angular指令在本地绑定DataViz饼图,但不断出现以下错误:

TypeError: Cannot call method 'toLowerCase' of undefined
    at h (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:5351)
    at Object.o.aggregate (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:20999)
    at g (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:5624)
    at ct.extend._process (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:31624)
    at ct.extend.success (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:28852)
    at Object.proxy [as success] (http://localhost:51717/Scripts/jquery-1.10.2.js:841:14)
    at ct.extend.read (http://localhost:51717/Scripts/kendo/kendo.web.min.js:11:21673)
    at http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:28381
    at ct.extend._queueRequest (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:30001)
    at ct.extend.read (http://localhost:51717/Scripts/kendo/kendo.dataviz.min.js:11:28266) 
HTML

<div kendo-chart k-options="pie" k-data-source="countries" />

检查库以确保您使用的是受支持的版本。您使用的是最新版本的KendoUI吗?根据您的需要:

  • jQuery v1.9.1(不确定是否支持更高版本)
  • 角度v1.0.5
  • 肯杜伊电流
我为你创造了退房的机会。代码如下:

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Angular + KendoUI DataViz" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.3.1119/js/kendo.all.min.js"></script>
<script src="http://rawgithub.com/kendo-labs/angular-kendo/master/build/angular-kendo.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="chart-example">
  <div ng-controller="ChartController">    
    <div kendo-chart k-options="pie" k-data-source="countries" />
  </div>
</body>
</html>

您使用的是哪个版本的剑道UI?可以添加包含剑道脚本的部分吗?切换我的脚本引用以使用kendo.all.min.js修复了此问题。我只是引用了kendo.dataviz和kendo.ui。工作示例不起作用。我试图用它来学习如何在angular中使用dataviz,但有些地方不对劲。。。
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Angular + KendoUI DataViz" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.3.1119/js/kendo.all.min.js"></script>
<script src="http://rawgithub.com/kendo-labs/angular-kendo/master/build/angular-kendo.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="chart-example">
  <div ng-controller="ChartController">    
    <div kendo-chart k-options="pie" k-data-source="countries" />
  </div>
</body>
</html>
var app = angular.module('chart-example', ['kendo.directives']);

function ChartController($scope) {
  $scope.pie = {
    title: {
        position: "bottom",
        text: "Share of Internet Population Growth, 2007 - 2012"
    },
    legend: {
        visible: false
    },
    chartArea: {
        background: ""
    },
    seriesDefaults: {
        labels: {
            visible: true,
            background: "transparent",
            template: "#= category #: #= value#%"
        }
    },
    series: [{
        type: "pie",
        field: "value",
        categoryField: "category"
    }],
    tooltip: {
        visible: true,
        format: "{0}%"
    }
  };

  $scope.countries = {
    data: [
        {
            category: "Asia",
            value: 53.8,
            color: "#9de219"
        }, {
            category: "Europe",
            value: 16.1,
            color: "#90cc38"
        }, {
            category: "Latin America",
            value: 11.3,
            color: "#068c35"
        }, {
            category: "Africa",
            value: 9.6,
            color: "#006634"
        }, {
            category: "Middle East",
            value: 5.2,
            color: "#004d38"
        }, {
            category: "North America",
            value: 3.6,
            color: "#033939"
        }
    ]
  };
}