angularjs - angular-dimple error TypeError: Cannot read property '_hasCategories' of null -
i trying build stacked-bar chart using dimple.js need through angular directives using angular-dimple
here have coded run sample example:
<script type="text/javascript"> var app = angular.module("dimpletestapp", ['angular-dimple']); app.controller('myctrl', ['$scope', 'dataservice', function($scope, dataservice) { dataservice.getdata().then(function(response) { $scope.graphdata = response.data; console.log($scope.graphdata); }); }]) .service('dataservice', ['$http', function($http) { return { getdata: function() { return $http.get('data.json'); } }; }]); </script> </head> <body ng-app='dimpletestapp'> <div ng-controller="myctrl"> <graph data="graphdata" orientation="horizontal"> <x-axis field="month"></x-axis> <y-axis field="sales"></y-axis> <stacked-bar field="storeid" value="2"></stacked-bar> </graph> </div> </body>
but getting error while running code:
typeerror: cannot read property '_hascategories' of null @ null.<anonymous> (http://dimplejs.org/dist/dimple.v2.0.0.min.js:1:10314) @ array.foreach (native) @ _getseriesdata (http://dimplejs.org/dist/dimple.v2.0.0.min.js:1:9714) @ draw (http://dimplejs.org/dist/dimple.v2.0.0.min.js:1:20275) @ draw (http://localhost/angular-dimple/bower_components/angular-dimple/lib/angular-dimple.js:175:15) @ addbar (http://localhost/angular-dimple/bower_components/angular-dimple/lib/angular-dimple.js:428:25) @ object.fn (http://localhost/angular-dimple/bower_components/angular-dimple/lib/angular-dimple.js:433:11) @ g.$get.g.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.8/angular.min.js:110:464) @ g.$get.g.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.8/angular.min.js:113:468) @ g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.8/angular.min.js:73:183)
can tell me wrong application , how can make running.
i have solved doing getting deeper angular-dimple library.
there mistake in documentation directive created using x
, y
elements while in example have mentioned x-axis
, y-axis
, when changed correct 1 worked.
here modified code:
<graph data="graphdata" orientation="horizontal"> <x field="month"></x> <y field="sales"></y> <stacked-bar field="storeid" ></stacked-bar> </graph>
Comments
Post a Comment