css - TypeError: (intermediate value)[type] is not a function -


i trying display simple chart following guide here: http://jtblin.github.io/angular-chart.js/

i using sails.js, angular, bootstrap , angular-chart.js

when load app, blank image chart should be. see error in chrome dev tools:

typeerror: (intermediate value)[type] not function @ createchart (angular-chart.js:175) @ object.fn (angular-chart.js:118) @ scope.$get.scope.$digest (angular.js:14308) @ scope.$get.scope.$apply (angular.js:14571) @ bootstrapapply (angular.js:1455) @ object.invoke (angular.js:4203) @ dobootstrap (angular.js:1453) @ bootstrap (angular.js:1473) @ angularinit (angular.js:1367) @ angular.js:26304 

please forgive me don't know why error popping.

i have tried endless amounts of variations of code below , feel version closest have gotten working sample.

view:

<head> <link rel="stylesheet" href="/styles/angular-chart.css"> </head>  <body ng-app="dashboardmodule" ng-controller="barctrl"> <canvas id="bar" class="chart chart-bar" data="data" labels="labels"></canvas>  <script src="/js/dependencies/sails.io.js"></script> <script src="/js/dependencies/angular.js"></script> <script src="/js/dependencies/chart.core.js"></script> <script src="/js/dependencies/angular-chart.js"></script> <script src="/js/private/dashboard/dashboardmodule.js"></script> <script src="/js/private/dashboard/dashboardcontroller.js"></script> </body> 

module:

angular.module('dashboardmodule', ['chart.js']); 

controller:

angular.module('dashboardmodule').controller("barctrl", function ($scope) {  $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; $scope.series = ['series a', 'series b'];  $scope.data = [   [65, 59, 80, 81, 56, 55, 40],   [28, 48, 40, 19, 86, 27, 90] ]; }); 

i think missing part adding these 2 dependencies perhaps:
-- chart.js
-- angular-chart.js

working version here: https://jsfiddle.net/cwlja39j/

fyi: jsfiddle, github files can added "external resources" running them through rawgit.com first.


markup:

<div ng-app="dashboardmodule" ng-controller="barctrl"> <canvas id="bar" class="chart chart-bar" data="data" labels="labels"></canvas> </div> 

js :

angular.module("dashboardmodule", ["chart.js"]).controller("barctrl", function ($scope) {   $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];   $scope.series = ['series a', 'series b'];    $scope.data = [     [65, 59, 80, 81, 56, 55, 40],     [28, 48, 40, 19, 86, 27, 90]   ]; }); 

(used chrome, no errors seen in console)


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -