mirror of
https://github.com/arnaucube/goBlockchainDataAnalysis.git
synced 2026-02-07 03:36:44 +01:00
Sankey data generated in backend, not yet showed correctly in frontend
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.sankey', ['ngRoute'])
|
||||
angular.module('app.sankey', ['ngRoute', 'ngSankey'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/sankey', {
|
||||
@@ -10,6 +10,43 @@ angular.module('app.sankey', ['ngRoute'])
|
||||
}])
|
||||
|
||||
.controller('SankeyCtrl', function($scope, $http, $routeParams) {
|
||||
|
||||
|
||||
$scope.options = {
|
||||
chart: '#sankeyChart',
|
||||
width: 960,
|
||||
height: 500,
|
||||
margin: {top: 1, right: 1, bottom: 6, left: 1},
|
||||
node: {width: 15, padding :10, showValue: false},
|
||||
value: {format: ',.0f', unit : ''},
|
||||
dynamicLinkColor: true,
|
||||
trafficInLinks: true
|
||||
};
|
||||
$scope.data={
|
||||
nodes: [],
|
||||
links: []
|
||||
};
|
||||
|
||||
$http.get(urlapi + 'alladdresses')
|
||||
.then(function(data, status, headers, config) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.addresses = data.data;
|
||||
}, function(data, status, headers, config) {
|
||||
console.log('data error');
|
||||
});
|
||||
$scope.getAddressSankey = function(address) {
|
||||
console.log(address);
|
||||
$http.get(urlapi + 'address/sankey/' + address.id)
|
||||
.then(function(data, status, headers, config) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.data.nodes = data.data.nodes;
|
||||
$scope.data.links = data.data.links;
|
||||
console.log($scope.data);
|
||||
let chart = new d3.sankeyChart(data.data, $scope.options);
|
||||
//$scope.data = data.data;
|
||||
}, function(data, status, headers, config) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user