How to stack series in nvd3 multibar angularjs directive

I want to create a multiple histogram with the nvd3 angularjs directive by the cmaurer directive (nvd3 directive ), but the problem is that I need to collect several series, and there is a strange error. here are my details:

$scope.exampleData = [ { "key": "Monto Inicial", "values": [[0, $scope.planAhorro.MontoInicial]] }, { "key": "Monto Periodico", "values": [[0, $scope.planAhorro.MontoPeriodico]] }, { "key": "Total Sueños", "values": [[1, $scope.planAhorro.Valor]] }]; 

I want to get 2 bars with the values ​​of $scope.planAhorro.MontoInicial and $scope.planAhorro.MontoPeriodico stacked, and the other bar with the value $scope.planAhorro.Valor one, but the thing is the first 2 decks and the third stack on top and I don’t need fold it!

and here is the result:

http://es.tinypic.com/r/2yvjnkw/8

+6
source share
1 answer

Suppose you need to adjust the values ​​for the entire range, in your case: for 0 and 1:

 $scope.exampleData = [ { "key": "Monto Inicial", "values": [[0, $scope.planAhorro.MontoInicial], [1, 0]], "color": "red" }, { "key": "Monto Periodico", "values": [[0, $scope.planAhorro.MontoPeriodico], [1, 0]], "color": "green" }, { "key": "Total Sueños", "values": [[0, ], [1, $scope.planAhorro.Valor]], "color": "#0000FF" //blue }]; 

Here is a demo , but I'm using angular-nvd3 .

+5
source

Source: https://habr.com/ru/post/970464/


All Articles