diff --git a/www/plugins/graph/css/style.css b/www/plugins/graph/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..0d97c8161095b32e210b86648283f901df7acfd3 --- /dev/null +++ b/www/plugins/graph/css/style.css @@ -0,0 +1,9 @@ + +/********** + Graph currency popover +**********/ + +.popover-graph-currency { + height: 300px !important; + max-width: 250px !important; +} diff --git a/www/plugins/graph/i18n/locale-en-GB.json b/www/plugins/graph/i18n/locale-en-GB.json index b758ed2fb4dd4362c8d1bd68f72da3501222bd3a..1a64beadbf60d937bb2bd42246536f07b320125e 100644 --- a/www/plugins/graph/i18n/locale-en-GB.json +++ b/www/plugins/graph/i18n/locale-en-GB.json @@ -11,6 +11,16 @@ "BTN_SHOW_STATS": "See statistics", "BTN_SHOW_DETAILED_STATS": "Detailed statistics" }, + "ACCOUNT": { + "TITLE": "Statistics", + "BTN_SHOW_STATS": "View account Statistics", + "BALANCE_DIVIDER": "Account status", + "BALANCE_TITLE": "Evolution of the account {{pubkey|formatPubkey}}", + "TX_RECEIVED_LABEL": "Receipts", + "TX_SENT_LABEL": "Spending", + "UD_LABEL": "UD", + "BALANCE_LABEL": "Balance" + }, "BLOCKCHAIN": { "TITLE": "Statistics", "BLOCKS_ISSUERS_DIVIDER": "Written blocks by members", @@ -24,6 +34,7 @@ "TX_COUNT_TITLE": "Number of written transactions", "TX_COUNT_LABEL": "Number of transactions", "TX_AVG_BY_BLOCK": "Average per block", + "TX_RANGE_DURATION_DIVIDER": "Step unit:", "TX_RANGE_DURATION": { "HOUR": "Group by <b>hour</b>", "DAY": "Group by <b>day</b>", diff --git a/www/plugins/graph/i18n/locale-en.json b/www/plugins/graph/i18n/locale-en.json index b758ed2fb4dd4362c8d1bd68f72da3501222bd3a..1a64beadbf60d937bb2bd42246536f07b320125e 100644 --- a/www/plugins/graph/i18n/locale-en.json +++ b/www/plugins/graph/i18n/locale-en.json @@ -11,6 +11,16 @@ "BTN_SHOW_STATS": "See statistics", "BTN_SHOW_DETAILED_STATS": "Detailed statistics" }, + "ACCOUNT": { + "TITLE": "Statistics", + "BTN_SHOW_STATS": "View account Statistics", + "BALANCE_DIVIDER": "Account status", + "BALANCE_TITLE": "Evolution of the account {{pubkey|formatPubkey}}", + "TX_RECEIVED_LABEL": "Receipts", + "TX_SENT_LABEL": "Spending", + "UD_LABEL": "UD", + "BALANCE_LABEL": "Balance" + }, "BLOCKCHAIN": { "TITLE": "Statistics", "BLOCKS_ISSUERS_DIVIDER": "Written blocks by members", @@ -24,6 +34,7 @@ "TX_COUNT_TITLE": "Number of written transactions", "TX_COUNT_LABEL": "Number of transactions", "TX_AVG_BY_BLOCK": "Average per block", + "TX_RANGE_DURATION_DIVIDER": "Step unit:", "TX_RANGE_DURATION": { "HOUR": "Group by <b>hour</b>", "DAY": "Group by <b>day</b>", diff --git a/www/plugins/graph/i18n/locale-fr-FR.json b/www/plugins/graph/i18n/locale-fr-FR.json index 1d2b236c9adbcd515ebf6351b7b9b3c01dbc9f64..99c5115c3a78c498254ac5fa0d94ef13df747aef 100644 --- a/www/plugins/graph/i18n/locale-fr-FR.json +++ b/www/plugins/graph/i18n/locale-fr-FR.json @@ -13,8 +13,9 @@ }, "ACCOUNT": { "TITLE": "Statistiques", + "BTN_SHOW_STATS": "Voir les statistiques du compte", "BALANCE_DIVIDER": "Situation du compte", - "BALANCE_TITLE": "Balance - {{pubkey|formatPubkey}}", + "BALANCE_TITLE": "Evolution du compte {{pubkey|formatPubkey}}", "TX_RECEIVED_LABEL": "Recettes", "TX_SENT_LABEL": "Dépenses", "TX_ACCUMULATION_LABEL": "Bilan des transactions", @@ -41,10 +42,11 @@ "TX_COUNT_TITLE": "Nombre de transactions écrites", "TX_COUNT_LABEL": "Nombre de transactions", "TX_AVG_BY_BLOCK": "Nombre moyen de transactions / bloc", + "TX_RANGE_DURATION_DIVIDER": "Unité de temps :", "TX_RANGE_DURATION": { - "HOUR": "Regrouper par <b>heure</b>", - "DAY": "Regrouper par <b>jour</b>", - "MONTH": "Regrouper par <b>mois</b>" + "HOUR": "Heure", + "DAY": "Jour", + "MONTH": "Mois" } }, "CURRENCY": { diff --git a/www/plugins/graph/js/controllers/account-controllers.js b/www/plugins/graph/js/controllers/account-controllers.js index 586e1119a98fb249c546a6fe564cfaef36728279..85c54ffaba105f878869a5d1cfb922826b8d6fc6 100644 --- a/www/plugins/graph/js/controllers/account-controllers.js +++ b/www/plugins/graph/js/controllers/account-controllers.js @@ -7,18 +7,25 @@ angular.module('cesium.graph.account.controllers', ['chart.js', 'cesium.graph.se var enable = csConfig.plugins && csConfig.plugins.es; if (enable) { - /*PluginServiceProvider - .extendState('app.view_wallet', { + PluginServiceProvider + .extendState('app.view_wallet_tx', { points: { - 'general': { - templateUrl: "plugins/graph/templates/network/view_wallet_extend.html", - controller: 'GpWalletExtendCtrl' + 'buttons': { + templateUrl: "plugins/graph/templates/account/view_wallet_tx_extend.html", + controller: 'GpExtendCtrl' } } }) - // TODO add wot extend - ;*/ + .extendState('app.wot_identity', { + points: { + 'buttons': { + templateUrl: "plugins/graph/templates/account/view_identity_extend.html", + controller: 'GpExtendCtrl' + } + } + }) + ; $stateProvider .state('app.view_wallet_stats', { @@ -44,7 +51,7 @@ angular.module('cesium.graph.account.controllers', ['chart.js', 'cesium.graph.se } }) - .controller('GpWalletExtendCtrl', GpWalletExtendController) + .controller('GpExtendCtrl', GpExtendController) .controller('GpAccountBalanceCtrl', GpAccountBalanceController) @@ -52,7 +59,7 @@ angular.module('cesium.graph.account.controllers', ['chart.js', 'cesium.graph.se ; -function GpWalletExtendController($scope, PluginService, esSettings) { +function GpExtendController($scope, PluginService, esSettings, $state, csWallet) { 'ngInject'; $scope.extensionPoint = PluginService.extensions.points.current.get(); @@ -61,10 +68,22 @@ function GpWalletExtendController($scope, PluginService, esSettings) { esSettings.api.state.on.changed($scope, function(enable) { $scope.enable = enable; }); + + $scope.showIdentityStats = function() { + if ($scope.formData && $scope.formData.pubkey) { + $state.go('app.wot_identity_stats', {pubkey: $scope.formData.pubkey}); + } + }; + + $scope.showWalletStats = function() { + if (csWallet.isLogin()) { + $state.go('app.wot_identity_stats', {pubkey: csWallet.data.pubkey}); + } + }; } -function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $translate, gpData, gpColor, csWallet) { +function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $translate, csWot, gpData, gpColor, csWallet) { 'ngInject'; // Initialize the super class and extend it. @@ -79,41 +98,62 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t $scope.formData.pubkey = csWallet.data.pubkey; } - // for DEV only - //$scope.formData.pubkey = '38MEAZN68Pz1DTvT3tqgxx4yQP6snJCQhPqEFxbDk4aE'; + }; + + $scope.inheritedSetScale = $scope.setScale; + $scope.setScale = function(scale) { + // linear scale: sent values as negative + if (scale === 'linear') { + $scope.data[$scope.data.length-2] = _.map($scope.data[$scope.data.length-2], function(value) { + return -1 * Math.abs(value); + }); + } + // log scale: sent values as positive + else { + $scope.data[$scope.data.length-2] = _.map($scope.data[$scope.data.length-2], function(value) { + return Math.abs(value); + }); + } + + $scope.inheritedSetScale(scale); }; $scope.load = function(updateTimePct) { updateTimePct = angular.isDefined(updateTimePct) ? updateTimePct : true; - return $q.all([ + var withUD = true; - $translate('GRAPH.ACCOUNT.BALANCE_TITLE', $scope.formData), + return csWot.load($scope.formData.pubkey) + .then(function(identity) { + $scope.identity = identity; + withUD = $scope.identity.isMember || $scope.identity.wasMember; - // translate i18n keys - $translate(['GRAPH.ACCOUNT.UD_LABEL', - 'GRAPH.ACCOUNT.TX_RECEIVED_LABEL', - 'GRAPH.ACCOUNT.TX_SENT_LABEL', - 'GRAPH.ACCOUNT.UD_ACCUMULATION_LABEL', - 'GRAPH.ACCOUNT.TX_ACCUMULATION_LABEL', - 'GRAPH.ACCOUNT.BALANCE_LABEL', - 'COMMON.DATE_PATTERN', - 'COMMON.DATE_SHORT_PATTERN', - 'COMMON.DATE_MONTH_YEAR_PATTERN']), + return $q.all([ - // get data - gpData.blockchain.movement($scope.formData.currency, angular.copy($scope.formData)) - ]) + $translate('GRAPH.ACCOUNT.BALANCE_TITLE', $scope.formData), + + // translate i18n keys + $translate(['GRAPH.ACCOUNT.UD_LABEL', + 'GRAPH.ACCOUNT.TX_RECEIVED_LABEL', + 'GRAPH.ACCOUNT.TX_SENT_LABEL', + 'GRAPH.ACCOUNT.UD_ACCUMULATION_LABEL', + 'GRAPH.ACCOUNT.TX_ACCUMULATION_LABEL', + 'GRAPH.ACCOUNT.BALANCE_LABEL', + 'COMMON.DATE_PATTERN', + 'COMMON.DATE_SHORT_PATTERN', + 'COMMON.DATE_MONTH_YEAR_PATTERN']), + + // get data + gpData.blockchain.movement($scope.formData.currency, angular.copy($scope.formData)) + ]); + }) .then(function(result) { var title = result[0]; var translations = result[1]; result = result[2]; - if (!result || !result.times) { - console.log('No DATA'); - return; // no data - } + if (!result || !result.times) return; // no data $scope.times = result.times; var formatInteger = $filter('formatInteger'); @@ -122,11 +162,9 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t // Data $scope.data = [ - //result.ud, + result.ud, result.received, result.sent, - result.udSum, - result.txSum, result.balance ]; @@ -161,28 +199,7 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t id: 'y-axis-left', type: 'linear', position: 'left', - ticks: { - beginAtZero:true, - callback: function(value) { - return formatInteger(value); - } - } - }, - { - id: 'y-axis-right', - type: 'linear', - position: 'right', - stacked: true, - display: false, - gridLines: { - show: false - }, - ticks: { - beginAtZero:true, - callback: function(value) { - return formatInteger(value); - } - } + stacked: true } ] }, @@ -194,73 +211,41 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t mode: 'index', callbacks: { label: function(tooltipItems, data) { - // Should add a '+' before value ? - var addPlus = (tooltipItems.datasetIndex < 2) - && tooltipItems.yLabel > 0; return data.datasets[tooltipItems.datasetIndex].label + ': ' + (!tooltipItems.yLabel ? '0' : - ((addPlus ? '+' : '') + formatAmount(tooltipItems.yLabel) + ' ' + $scope.currencySymbol)); + (formatAmount(tooltipItems.yLabel) + ' ' + $scope.currencySymbol)); } } } }; + $scope.setScale($scope.scale); $scope.datasetOverride = [ - /*{ - yAxisID: 'y-axis-right', + { + yAxisID: 'y-axis-left', type: 'bar', label: translations['GRAPH.ACCOUNT.UD_LABEL'], backgroundColor: gpColor.rgba.energized(0.3), hoverBackgroundColor: gpColor.rgba.energized(0.5), borderWidth: 1 - },*/ + }, { - yAxisID: 'y-axis-right', + yAxisID: 'y-axis-left', type: 'bar', label: translations['GRAPH.ACCOUNT.TX_RECEIVED_LABEL'], - backgroundColor: gpColor.rgba.positive(0.3), - hoverBackgroundColor: gpColor.rgba.positive(0.5), + backgroundColor: gpColor.rgba.positive(0.4), + hoverBackgroundColor: gpColor.rgba.positive(0.6), borderWidth: 1 }, { - yAxisID: 'y-axis-right', + yAxisID: 'y-axis-left', type: 'bar', label: translations['GRAPH.ACCOUNT.TX_SENT_LABEL'], - backgroundColor: gpColor.rgba.gray(0.3), - hoverBackgroundColor: gpColor.rgba.gray(0.5), + backgroundColor: gpColor.rgba.assertive(0.4), + hoverBackgroundColor: gpColor.rgba.assertive(0.6), borderWidth: 1 }, - { - yAxisID: 'y-axis-left', - type: 'line', - label: translations['GRAPH.ACCOUNT.UD_ACCUMULATION_LABEL'], - fill: false, - borderColor: gpColor.rgba.energized(0.5), - borderWidth: 2, - backgroundColor: gpColor.rgba.energized(0.7), - pointBackgroundColor: gpColor.rgba.energized(0.5), - pointBorderColor: gpColor.rgba.white(), - pointHoverBackgroundColor: gpColor.rgba.energized(1), - pointHoverBorderColor: 'rgba(0,0,0,0)', - pointRadius: 3, - lineTension: 0.1 - }, - { - yAxisID: 'y-axis-left', - type: 'line', - label: translations['GRAPH.ACCOUNT.TX_ACCUMULATION_LABEL'], - fill: false, - borderColor: gpColor.rgba.positive(0.5), - borderWidth: 2, - backgroundColor: gpColor.rgba.positive(0.7), - pointBackgroundColor: gpColor.rgba.positive(0.5), - pointBorderColor: gpColor.rgba.white(), - pointHoverBackgroundColor: gpColor.rgba.positive(1), - pointHoverBorderColor: 'rgba(0,0,0,0)', - pointRadius: 3, - lineTension: 0.1 - }, { yAxisID: 'y-axis-left', type: 'line', @@ -276,6 +261,19 @@ function GpAccountBalanceController($scope, $controller, $q, $state, $filter, $t lineTension: 0.1 } ]; + + + if (!withUD) { + // remove UD + $scope.data.splice(0,1); + $scope.datasetOverride.splice(0,1); + } + else { + // FIXME: fund why UD data not working well + // remove UD + /*$scope.data.splice(0,1); + $scope.datasetOverride.splice(0,1);*/ + } }); }; @@ -339,10 +337,7 @@ function GpAccountCertificationController($scope, $controller, $q, $state, $filt var translations = result[1]; result = result[2]; - if (!result || !result.times) { - console.log('No DATA'); - return; // no data - } + if (!result || !result.times) return; // no data $scope.times = result.times; var formatInteger = $filter('formatInteger'); diff --git a/www/plugins/graph/js/controllers/blockchain-controllers.js b/www/plugins/graph/js/controllers/blockchain-controllers.js index a9b770aa7b02022ed98c4fc7820114ee3cd63d91..f1befd6b58af37a47f69fec8aefc8e1d0af35d6b 100644 --- a/www/plugins/graph/js/controllers/blockchain-controllers.js +++ b/www/plugins/graph/js/controllers/blockchain-controllers.js @@ -120,31 +120,19 @@ function GpBlockchainTxCountController($scope, $controller, $q, $state, $filter, { id: 'y-axis-amount', type: 'linear', - position: 'left', - ticks: { - beginAtZero:true, - callback: function(value) { - return formatInteger(value); - } - } + position: 'left' }, { id: 'y-axis-count', display: false, type: 'linear', - position: 'right', - ticks: { - beginAtZero:true - } + position: 'right' }, { id: 'y-axis-avg', display: false, type: 'linear', - position: 'right', - ticks: { - beginAtZero:true - } + position: 'right' } ] }, @@ -165,6 +153,8 @@ function GpBlockchainTxCountController($scope, $controller, $q, $state, $filter, } }; + $scope.setScale($scope.scale); + $scope.datasetOverride = [ { yAxisID: 'y-axis-amount', diff --git a/www/plugins/graph/js/controllers/common-controllers.js b/www/plugins/graph/js/controllers/common-controllers.js index 3c4a2437e782a7a5ba8f3b8ced6d763570cc313d..69c80fd5b0c6d0d13d6dadf063f2ffa20133a920 100644 --- a/www/plugins/graph/js/controllers/common-controllers.js +++ b/www/plugins/graph/js/controllers/common-controllers.js @@ -14,8 +14,8 @@ function GpCurrencyAbstractController($scope, $filter, $ionicPopover, $ionicHist rangeDuration: 'day', firstBlockTime: 0 }; - $scope.formData.useRelative = angular.isDefined($scope.formData.useRelative) ? - $scope.formData.useRelative : csSettings.data.useRelative; + $scope.formData.useRelative = false; /*angular.isDefined($scope.formData.useRelative) ? + $scope.formData.useRelative : csSettings.data.useRelative;*/ $scope.scale = 'linear'; $scope.height = undefined; $scope.width = undefined; @@ -110,6 +110,10 @@ function GpCurrencyAbstractController($scope, $filter, $ionicPopover, $ionicHist // Should be override by subclasses }; + $scope.toggleScale = function() { + $scope.setScale($scope.scale === 'linear' ? 'logarithmic' : 'linear'); + }; + $scope.setScale = function(scale) { $scope.hideActionsPopover(); $scope.scale = scale; @@ -127,7 +131,7 @@ function GpCurrencyAbstractController($scope, $filter, $ionicPopover, $ionicHist }; } else { - yAxe.ticks.min = 0; + //yAxe.ticks.min = 0; delete yAxe.ticks.beginAtZero; delete yAxe.ticks.callback; yAxe.ticks.callback = function(value, index) { @@ -160,6 +164,9 @@ function GpCurrencyAbstractController($scope, $filter, $ionicPopover, $ionicHist }; $scope.goPreviousRange = function() { + if ($scope.loading) return; + $scope.loading = true; + $scope.formData.startTime -= $scope.times.length * $scope.formData.rangeDurationSec; if ($scope.formData.startTime < $scope.formData.firstBlockTime) { $scope.formData.startTime = $scope.formData.firstBlockTime; @@ -167,31 +174,46 @@ function GpCurrencyAbstractController($scope, $filter, $ionicPopover, $ionicHist $scope.formData.endTime = $scope.formData.startTime + $scope.times.length * $scope.formData.rangeDurationSec; // Reload data - $scope.load(); - // Update location - $scope.updateLocation(); + $scope.load().then(function(){ + // Update location + $scope.updateLocation(); + + $scope.loading = false; + }); }; $scope.goNextRange = function() { + if ($scope.loading) return; + $scope.loading = true; $scope.formData.startTime += $scope.times.length * $scope.formData.rangeDurationSec; if ($scope.formData.startTime > $scope.formData.firstBlockTime + $scope.formData.currencyAge - $scope.formData.timeWindow) { $scope.formData.startTime = $scope.formData.firstBlockTime + $scope.formData.currencyAge - $scope.formData.timeWindow; } $scope.formData.endTime = $scope.formData.startTime + $scope.times.length * $scope.formData.rangeDurationSec; + // Reload data - $scope.load(); - // Update location - $scope.updateLocation(); + $scope.load().then(function(){ + // Update location + $scope.updateLocation(); + + $scope.loading = false; + }); }; $scope.onRangeChanged = function() { + if ($scope.loading) return; + $scope.loading = true; + $scope.formData.startTime = $scope.formData.firstBlockTime + (parseFloat($scope.formData.timePct) / 100) * ($scope.formData.currencyAge - $scope.formData.timeWindow) ; $scope.formData.endTime = $scope.formData.startTime + $scope.times.length * $scope.formData.rangeDurationSec; // Reload data - $scope.load(false); - // Update location - $scope.updateLocation(); + $scope.load().then(function(){ + // Update location + $scope.updateLocation(); + + $scope.loading = false; + }); }; $scope.updateRange = function(startTime, endTime, updateTimePct) { diff --git a/www/plugins/graph/js/services/data-services.js b/www/plugins/graph/js/services/data-services.js index fc0a05b5ea528fabe88459d4bf7f834e19e613b0..b2c6677bb9a96cd91851506f551a6ec03be67ec2 100644 --- a/www/plugins/graph/js/services/data-services.js +++ b/www/plugins/graph/js/services/data-services.js @@ -395,10 +395,8 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. return res.concat({ from: agg.from, to: agg.to, - sent: -sent.sum / 100, - received: received.sum / 100, - delta: (received.sum - sent.sum) / 100, - count: received.count + sent.count + sent: sent.sum ? (-sent.sum / 100) : 0, + received: received.sum ? (received.sum / 100) : 0 }); }, []); }); @@ -472,29 +470,14 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. var from = moment.unix(options.startTime).utc().startOf(options.rangeDuration); var to = moment.unix(options.endTime).utc(); - // Add a range to get TX before startTime - var ranges = [{ - from: 0, - to: from.unix() - }]; - - var memberships = angular.copy(options.memberships).reverse(); - var membership = memberships.pop(); - while (membership && (membership.leaveTime && membership.leaveTime < from.unix())) { - membership = memberships.pop(); - } - + var ranges = []; var udRanges = []; var udFromMapping = {}; + var memberships = angular.copy(options.memberships).reverse(); + var membership = memberships.pop(); - while(from.isBefore(to)) { - - var range = { - from: from.unix(), - to: from.add(1, options.rangeDuration).unix() - }; + function addRange(range) { ranges.push(range); - var member = membership && membership.joinTime < range.to; if (member) { var udRange = { @@ -507,6 +490,20 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. membership = memberships.pop(); } } + } + + // Add a range to get TX before startTime + addRange({ + from: 0, + to: from.unix() + }); + + while(from.isBefore(to)) { + + addRange({ + from: from.unix(), + to: from.add(1, options.rangeDuration).unix() + }); // Do not exceed max range count if ((!jobs.length && ranges.length == options.maxRangeSize+1) || (jobs.length && ranges.length == options.maxRangeSize)) { @@ -518,14 +515,23 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. ]) .then(function(res){ var udsMap = res[0]; - res[1].forEach(function(hit){ - hit.ud = udsMap[hit.from]||0; + res = res[1]; + // fill UD + res.forEach(function(hit){ + hit.ud = (udsMap[hit.from]) || 0; }); - return res[1]; + return res; })); } else { - jobs.push(exports.raw.movement.getByRange(currency, options.pubkey, ranges)); + jobs.push(exports.raw.movement.getByRange(currency, options.pubkey, ranges) + .then(function(res){ + // fill UD + res.forEach(function(hit){ + hit.ud = 0; + }); + return res; + })); } // reset ranges for the next loop @@ -548,29 +554,17 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. // First item should be history (tx before startTime) var history = res.splice(0,1)[0]; - var txSum = history.delta||0; - var udSum = history.ud||0; - var balance = history.delta+(history.ud||0); + var balance = history.received + history.sent + history.ud; return { times: _.pluck(res, 'from'), + ud: _.pluck(res, 'ud'), sent: _.pluck(res, 'sent'), received: _.pluck(res, 'received'), - delta: _.pluck(res, 'delta'), - ud: _.pluck(res, 'ud'), - txSum: res.reduce(function(res, hit){ - txSum += hit.delta; - return res.concat(txSum); - }, []), - udSum: res.reduce(function(res, hit){ - udSum += hit.ud||0; - return res.concat(udSum); - }, []), balance: res.reduce(function(res, hit){ - balance += hit.delta+(hit.ud||0); + balance += hit.received + hit.sent + hit.ud; return res.concat(balance); - }, []), - count: _.pluck(res, 'count') + }, []) }; }); }; diff --git a/www/plugins/graph/templates/account/view_identity_extend.html b/www/plugins/graph/templates/account/view_identity_extend.html new file mode 100644 index 0000000000000000000000000000000000000000..65ff216dbc2b9417ebb031c94e8af2aa22f0f7cb --- /dev/null +++ b/www/plugins/graph/templates/account/view_identity_extend.html @@ -0,0 +1,9 @@ +<!-- Buttons section --> +<ng-if ng-if="extensionPoint === 'buttons'"> + + <button class="button button-stable button-small-padding icon ion-stats-bars" + ng-click="showIdentityStats()" + title="{{'GRAPH.ACCOUNT.BTN_SHOW_STATS' | translate}}"> + </button> + +</ng-if> diff --git a/www/plugins/graph/templates/account/view_stats.html b/www/plugins/graph/templates/account/view_stats.html index 7ded7f9e7d90a27307927b17e3d3c9ba5392a5fe..8b21f2ddcbda4652510d4a500904face8d79daec 100644 --- a/www/plugins/graph/templates/account/view_stats.html +++ b/www/plugins/graph/templates/account/view_stats.html @@ -23,8 +23,8 @@ ng-init="setSize(350, 1000)"> </div> - <!-- - - - - Balance - - - - --> - <div class="item item-divider" translate> + <!-- - - - - WOT - - - - --> + <!--<div class="item item-divider" translate> GRAPH.ACCOUNT.WOT_DIVIDER </div> @@ -32,7 +32,7 @@ ng-include="'plugins/graph/templates/account/graph_certifications.html'" ng-controller="GpAccountCertificationCtrl" ng-init="setSize(350, 1000)"> - </div> + </div>--> </ion-content> diff --git a/www/plugins/graph/templates/account/view_wallet_tx_extend.html b/www/plugins/graph/templates/account/view_wallet_tx_extend.html new file mode 100644 index 0000000000000000000000000000000000000000..b8cd1c04adaf3a3830be19e9902bec5c9dc7ec7d --- /dev/null +++ b/www/plugins/graph/templates/account/view_wallet_tx_extend.html @@ -0,0 +1,9 @@ +<!-- Buttons section --> +<ng-if ng-if="extensionPoint === 'buttons'"> + + <button class="button button-stable button-small-padding icon ion-stats-bars" + ng-click="showWalletStats()" + title="{{'GRAPH.ACCOUNT.BTN_SHOW_STATS' | translate}}"> + </button> + +</ng-if> diff --git a/www/plugins/graph/templates/common/popover_range_actions.html b/www/plugins/graph/templates/common/popover_range_actions.html index 2211f9359fe7ab2aea5042bb324fd1abb7d5cfa3..31745aa69cad20d2ea164c0f3f4ba60b945c5915 100644 --- a/www/plugins/graph/templates/common/popover_range_actions.html +++ b/www/plugins/graph/templates/common/popover_range_actions.html @@ -1,29 +1,41 @@ -<ion-popover-view class="fit has-header"> +<ion-popover-view class="has-header popover-graph-currency"> <ion-header-bar> <h1 class="title" translate>COMMON.POPOVER_ACTIONS_TITLE</h1> </ion-header-bar> <ion-content scroll="false"> <div class="list item-text-wrap"> + <!-- scale --> + <a class="item item-icon-left ink" + ng-click="toggleScale()"> + <i class="icon ion-ios-checkmark-empty" ng-show="scale=='logarithmic'"></i> + <span ng-bind-html="'GRAPH.COMMON.LOGARITHMIC_SCALE' | translate"></span> + </a> + + <!-- duration divider --> + <div class="item item-divider"> + {{'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION_DIVIDER'|translate}} + </div> + <!-- duration: hour --> - <a class="item item-icon-right ink" + <a class="item item-icon-left ink" ng-click="setRangeDuration('hour')"> - <span ng-bind-html="'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION.HOUR' | translate"></span> <i class="icon ion-ios-checkmark-empty" ng-show="formData.rangeDuration=='hour'"></i> + <span ng-bind-html="'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION.HOUR' | translate"></span> </a> <!-- duration: day --> - <a class="item item-icon-right ink" + <a class="item item-icon-left ink" ng-click="setRangeDuration('day')"> - <span ng-bind-html="'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION.DAY' | translate"></span> <i class="icon ion-ios-checkmark-empty" ng-show="formData.rangeDuration=='day'"></i> + <span ng-bind-html="'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION.DAY' | translate"></span> </a> <!-- duration: month --> - <a class="item item-icon-right ink" + <a class="item item-icon-left ink" ng-click="setRangeDuration('month')"> - <span ng-bind-html="'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION.MONTH' | translate"></span> <i class="icon ion-ios-checkmark-empty" ng-show="formData.rangeDuration=='month'"></i> + <span ng-bind-html="'GRAPH.BLOCKCHAIN.TX_RANGE_DURATION.MONTH' | translate"></span> </a> </div>