angular-dc icon indicating copy to clipboard operation
angular-dc copied to clipboard

Waiting on an http request

Open jetheurer opened this issue 9 years ago • 1 comments

I need to wait for an API call to return before generating the chart; however its not clear how to do this.

Thanks!

Liz

jetheurer avatar Mar 08 '16 17:03 jetheurer

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();

            }); 

sallespro avatar Oct 17 '16 15:10 sallespro