You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB

  1. 'use strict';
  2. angular.module('app.tx', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/tx/:txid', {
  5. templateUrl: 'views/tx/tx.html',
  6. controller: 'TxCtrl'
  7. });
  8. }])
  9. .controller('TxCtrl', function($scope, $http, $routeParams) {
  10. $scope.tx = {};
  11. $http.get(urlapi + 'tx/' + $routeParams.txid)
  12. .then(function(data, status, headers, config) {
  13. console.log(data);
  14. $scope.tx = data.data;
  15. }, function(data, status, headers, config) {
  16. console.log('data error');
  17. });
  18. //Sankey
  19. $scope.options = {
  20. chart: '#sankeyChart',
  21. width: 1000,
  22. height: 280,
  23. margin: {top: 1, right: 1, bottom: 6, left: 1},
  24. node: {width: 15, padding :10, showValue: false},
  25. value: {format: ',.0f', unit : ''},
  26. dynamicLinkColor: true,
  27. trafficInLinks: true
  28. };
  29. $scope.data={
  30. nodes: [],
  31. links: []
  32. };
  33. $http.get(urlapi + 'tx/' + $routeParams.txid + '/sankey')
  34. .then(function(data, status, headers, config) {
  35. console.log('data success');
  36. console.log(data);
  37. $scope.data.nodes = data.data.nodes;
  38. $scope.data.links = data.data.links;
  39. console.log($scope.data);
  40. d3.selectAll("svg > *").remove();
  41. let chart = new d3.sankeyChart(data.data, $scope.options);
  42. //$scope.data = data.data;
  43. }, function(data, status, headers, config) {
  44. console.log('data error');
  45. });
  46. });