javascript - generating bar chart with angular and nvd3 -


i trying generate bar chart using angularjs , nvd3. controller this:

function initmycontroller(fac, $scope, data_url, $http){     $http.get(data_url).success(function(response){       console.log(response);       var values = [];       $scope.data = [];       angular.foreach(response, function(item) {         //in response have correct values         values.push({'label:' : item.label, 'value:' : item.value});       });        $scope.data = values;     });   } 

on view have this

<div ng-controller="myctrl">         <nvd3 options="options"               data="data"               config="config"               events="events"               api="api"></nvd3>        </div> 

but error when trying render graphic.

typeerror: cannot read property 'length' of undefined     @ http://localhost:9000/bower_components/nvd3/nv.d3.js:3684:78     @ array.filter (native)     @ svgsvgelement.<anonymous> (http://localhost:9000/bower_components/nvd3/nv.d3.js:3684:42)     @ http://localhost:9000/bower_components/d3/d3.js:8114:14     @ d3_selection_each (http://localhost:9000/bower_components/d3/d3.js:888:30)     @ array.d3_transitionprototype.each (http://localhost:9000/bower_components/d3/d3.js:8112:7)     @ array.chart (http://localhost:9000/bower_components/nvd3/nv.d3.js:3664:15)     @ array.d3_selectionprototype.call (http://localhost:9000/bower_components/d3/d3.js:895:14)     @ object.link.scope.api.updatewithdata (http://localhost:9000/bower_components/angular-nvd3/dist/angular-nvd3.min.js:1:5556)     @ object.link.scope.api.updatewithoptions (http://localhost:9000/bower_components/angular-nvd3/dist/angular-nvd3.min.js:1:4752)   (anonymous function)     $get     $get.scope.$digest       scopeprototype.$digest       $get.scope.$apply    scopeprototype.$apply    done     completerequest      requestloaded  

what missing?


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -