angular-dc
angular-dc copied to clipboard
Waiting on an http request
I need to wait for an API call to return before generating the chart; however its not clear how to do this.
Thanks!
Liz
i am in the same Endeavour, but it seems there are some issues to deal with.
i used the PieChart as a starting point. https://tomneyland.github.io/angular-dc/example/stocks/pie.html
and included the d3.request call instead of d3.json which doesn't allow to POST a query data.
BUT i get this error:
angular.js:9563 TypeError: _listeners.preRender is not a function
at Object._chart.render (base-mixin.js:639)
at Object.fn (angular-dc.min.js:8)
at h.$digest (angular.js:12031)
at h.$apply (angular.js:12279)
at angular.js:13786
at e (angular.js:4236)
at angular.js:4537
d3.request('url-to-query')
.header('Content-Type', 'application/json' )
.post(JSON.stringify(payload),
function( experiments ) {
ndx = crossfilter(experiments)
$scope.runDimension = ndx.dimension(function(d) { return d.age; }),
$scope.speedSumGroup = $scope.runDimension.group().all();
});