Daniel Rodríguez
Daniel Rodríguez

Reputation: 11

Angular NVD3 access the API in a loop

I need to repeat a underdetermine number of graphs. In the tool, I also need to access to the NVD3 API. For that I try to use code like this:

<div ng-repeat="val in values">
    <nvd3 options = "char[val].options" data = "chart[val].data" api = "chart[val].api">
    </nvd3>
</div>

The problem is where I tried to the API in the angular code I get an error and the figure does not show in the page. Anyone know how to set the API in a nvd3 plot into a loop?

Upvotes: 0

Views: 85

Answers (1)

Daniel Rodr&#237;guez
Daniel Rodr&#237;guez

Reputation: 11

I have been able to solve the problem introducing a delay before use the API object in the code.

$interval(function () {
  $scope.chart[val].api.refresh();
}, 100, 1);

Upvotes: 0

Related Questions