我正在使用高图来显示我的移动应用上的一些信息。它使用cordova,Jquery Mobile和AngularJS创建。当我运行应用程序时,图表不会显示,我收到以下错误。
TypeError: undefined is not a function
at Object.Ya.init (file:///D:/My%20Workspace/FireFox<div id="chart1" config="chartConfig" class="ng-isolate-scope">S/BMITracker_JQM/www/js/highcharts.js:190:496)
at Object.Ya (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/highcharts.js:15:312)
at link.initChart (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/highcharts-ng.js:228:105)
at link (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/highcharts-ng.js:238:9)
at file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/angular.min.js:67:494
at Fc (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/angular.min.js:68:47)
at K (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/angular.min.js:57:259)
at g (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/angular.min.js:49:491)
at g (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/angular.min.js:50:4)
at K (file:///D:/My%20Workspace/FireFox%OS/BMITracker_JQM/www/js/angular.min.js:57:204) VM1232 angular.min.js:98(anonymous function) VM1232 angular.min.js:98$get VM1232 angular.min.js:73Fc VM1232 angular.min.js:68K VM1232 angular.min.js:57g VM1232 angular.min.js:49g VM1232 angular.min.js:50K VM1232 angular.min.js:57g VM1232 angular.min.js:49g VM1232 angular.min.js:50(anonymous function) VM1232 angular.min.js:49(anonymous function) VM1232 angular.min.js:18$get.k.$eval VM1232 angular.min.js:120$get.k.$apply VM1232 angular.min.js:121(anonymous function) VM1232 angular.min.js:18e VM1232 angular.min.js:36d VM1232 angular.min.js:18hc VM1232 angular.min.js:18xd VM1232 angular.min.js:17(anonymous function) VM1232 angular.min.js:239a VM1232 angular.min.js:159c
我无法弄清楚错误是什么以及错误来自哪里。请帮忙。
HTML
<div id="progressPage" data-role="page" data-theme="a" ng-controller="ProgressController">
....
<div data-role="content" data-theme="a">
<highchart id="chart1" config="chartConfig" class="chart-canvas"></highchart>
</div>
....
</div>
AngularJS控制器
.controller('ProgressController', function($scope) {
$scope.chartConfig = {
options: {
chart: {
type: 'line'
}
},
series: [{
data: [10, 15, 12, 8, 7]
}],
title: {
text: 'Hello'
},
loading: false
};
})
CSS
.chart-canvas {
width: 100%;
height: 200px;
}
答案 0 :(得分:0)
我设法通过从highcharts-ng.js
if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.exports === exports){
module.exports = 'highcharts-ng';
}
你可以在文件的顶部找到它。
并且不要忘记包含jQuery