diff --git a/www/js/app.js b/www/js/app.js index 391a8da93802a57854579df40ad74ef70116a650..0063845c0b35851ed4b13a68afc3fb91a41f6973 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -24,6 +24,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht .filter('formatAmount', function(csConfig, csSettings, csWallet, $filter) { var minValue = 1 / Math.pow(10, csConfig.decimalCount || 4); var format = '0,0.0' + Array(csConfig.decimalCount || 4).join('0'); + var currencySymbol = $filter('currencySymbol'); function formatRelative(input, options) { var currentUD = options && options.currentUD ? options.currentUD : csWallet.data.currentUD; @@ -39,7 +40,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht amount = numeral(amount).format(format); } if (options && options.currency) { - return amount + ' ' + $filter('currencySymbol')(options.currency, true); + return amount + ' ' + currencySymbol(options.currency, true); } return amount; } @@ -47,7 +48,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht function formatQuantitative(input, options) { var amount = numeral(input/100).format((input > -1000000000 && input < 1000000000) ? '0,0.00' : '0,0.000 a'); if (options && options.currency) { - return amount + ' ' + $filter('currencySymbol')(options.currency, false); + return amount + ' ' + currencySymbol(options.currency, false); } return amount; } @@ -60,6 +61,47 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht }; }) + .filter('formatAmountNoHtml', function(csConfig, csSettings, csWallet, $filter) { + var minValue = 1 / Math.pow(10, csConfig.decimalCount || 4); + var format = '0,0.0' + Array(csConfig.decimalCount || 4).join('0'); + var currencySymbol = $filter('currencySymbolNoHtml'); + + function formatRelative(input, options) { + var currentUD = options && options.currentUD ? options.currentUD : csWallet.data.currentUD; + if (!currentUD) { + console.warn("formatAmount: currentUD not defined"); + return; + } + var amount = input / currentUD; + if (Math.abs(amount) < minValue && input !== 0) { + amount = '~ 0'; + } + else { + amount = numeral(amount).format(format); + } + if (options && options.currency) { + return amount + ' ' + currencySymbol(options.currency, true); + } + return amount; + } + + function formatQuantitative(input, options) { + var amount = numeral(input/100).format((input > -1000000000 && input < 1000000000) ? '0,0.00' : '0,0.000 a'); + if (options && options.currency) { + return amount + ' ' + currencySymbol(options.currency, false); + } + return amount; + } + + return function(input, options) { + if (input === undefined) return; + return (options && angular.isDefined(options.useRelative) ? options.useRelative : csSettings.data.useRelative) ? + formatRelative(input, options) : + formatQuantitative(input, options); + }; + }) + + .filter('currencySymbol', function($rootScope, $filter, csSettings) { return function(input, useRelative) { if (!input) return ''; diff --git a/www/plugins/graph/i18n/locale-en-GB.json b/www/plugins/graph/i18n/locale-en-GB.json index bb4df7efbda5552c2c1fd446dbba77e34814562c..ac49cdd8fa3b7f566c0b3eb7c5c5c278222093fe 100644 --- a/www/plugins/graph/i18n/locale-en-GB.json +++ b/www/plugins/graph/i18n/locale-en-GB.json @@ -8,7 +8,8 @@ "COMMON": { "LINEAR_SCALE" : "Linear scale", "LOGARITHMIC_SCALE" : "Logarithmic scale", - "BTN_SHOW_STATS": "See statistics" + "BTN_SHOW_STATS": "See statistics", + "BTN_SHOW_DETAILED_STATS": "Detailed statistics" }, "BLOCKCHAIN": { "TITLE": "Statistics", @@ -17,6 +18,8 @@ "BLOCKS_ISSUERS_TITLE": "Number of blocks calculated per member", "BLOCKS_ISSUERS_LABEL": "Number of blocks", "TX_DIVIDER": "Analysis of transactions", + "TX_AMOUNT_TITLE": "Transaction volume", + "TX_AMOUNT_LABEL": "Exchange volume", "TX_COUNT_TITLE": "Number of written transactions", "TX_COUNT_LABEL": "Number of transactions", "TX_AVG_BY_BLOCK": "Average per block", @@ -27,11 +30,12 @@ } }, "CURRENCY": { + "MONETARY_MASS_TITLE": "Evolution of the monetary mass", + "MONETARY_MASS_LABEL": "Monetary mass", + "MONETARY_MASS_SHARE_LABEL": "Average per member", + "UD_TITLE": "Evolution of the universal dividend", "MEMBERS_COUNT_TITLE": "Evolution of the number of members", - "MEMBERS_COUNT_LABEL": "Number of members", - "MONETARY_MASS_TITLE": "Evolution of the monetary mass ({{currency | currencySymbolNoHtml: false }})", - "MONETARY_MASS_TITLE_RELATIVE": "Evolution of the monetary mass ({{currency | currencySymbolNoHtml: true }})", - "MONETARY_MASS_LABEL": "Monetary mass" + "MEMBERS_COUNT_LABEL": "Number of members" } } } diff --git a/www/plugins/graph/i18n/locale-en.json b/www/plugins/graph/i18n/locale-en.json index bb4df7efbda5552c2c1fd446dbba77e34814562c..ac49cdd8fa3b7f566c0b3eb7c5c5c278222093fe 100644 --- a/www/plugins/graph/i18n/locale-en.json +++ b/www/plugins/graph/i18n/locale-en.json @@ -8,7 +8,8 @@ "COMMON": { "LINEAR_SCALE" : "Linear scale", "LOGARITHMIC_SCALE" : "Logarithmic scale", - "BTN_SHOW_STATS": "See statistics" + "BTN_SHOW_STATS": "See statistics", + "BTN_SHOW_DETAILED_STATS": "Detailed statistics" }, "BLOCKCHAIN": { "TITLE": "Statistics", @@ -17,6 +18,8 @@ "BLOCKS_ISSUERS_TITLE": "Number of blocks calculated per member", "BLOCKS_ISSUERS_LABEL": "Number of blocks", "TX_DIVIDER": "Analysis of transactions", + "TX_AMOUNT_TITLE": "Transaction volume", + "TX_AMOUNT_LABEL": "Exchange volume", "TX_COUNT_TITLE": "Number of written transactions", "TX_COUNT_LABEL": "Number of transactions", "TX_AVG_BY_BLOCK": "Average per block", @@ -27,11 +30,12 @@ } }, "CURRENCY": { + "MONETARY_MASS_TITLE": "Evolution of the monetary mass", + "MONETARY_MASS_LABEL": "Monetary mass", + "MONETARY_MASS_SHARE_LABEL": "Average per member", + "UD_TITLE": "Evolution of the universal dividend", "MEMBERS_COUNT_TITLE": "Evolution of the number of members", - "MEMBERS_COUNT_LABEL": "Number of members", - "MONETARY_MASS_TITLE": "Evolution of the monetary mass ({{currency | currencySymbolNoHtml: false }})", - "MONETARY_MASS_TITLE_RELATIVE": "Evolution of the monetary mass ({{currency | currencySymbolNoHtml: true }})", - "MONETARY_MASS_LABEL": "Monetary mass" + "MEMBERS_COUNT_LABEL": "Number of members" } } } diff --git a/www/plugins/graph/i18n/locale-es-ES.json b/www/plugins/graph/i18n/locale-es-ES.json index 9cfd28983659cbf60cf50fea45c7e6ff84ae0573..7c475c0b0c092109970a571a66ff6a711e974ffc 100644 --- a/www/plugins/graph/i18n/locale-es-ES.json +++ b/www/plugins/graph/i18n/locale-es-ES.json @@ -8,7 +8,8 @@ "COMMON": { "LINEAR_SCALE" : "Escala lineal", "LOGARITHMIC_SCALE" : "Escala logarÃtmica", - "BTN_SHOW_STATS": "Ver estadÃsticas" + "BTN_SHOW_STATS": "Ver estadÃsticas", + "BTN_SHOW_DETAILED_STATS": "EstadÃsticas detalladas" }, "BLOCKCHAIN": { "TITLE": "EstadÃstica", @@ -17,6 +18,8 @@ "BLOCKS_ISSUERS_TITLE": "Número de bloques miembro calculado", "BLOCKS_ISSUERS_LABEL": "Número de bloques", "TX_DIVIDER": "Análisis de transacciones", + "TX_AMOUNT_TITLE": "El volumen de operaciones", + "TX_AMOUNT_LABEL": "Volumen negociado", "TX_COUNT_TITLE": "Número de transacciones escritas", "TX_COUNT_LABEL": "Número de transacciones", "TX_AVG_BY_BLOCK": "Promedio por bloque", @@ -27,11 +30,12 @@ } }, "CURRENCY": { + "MONETARY_MASS_TITLE": "Evolución de la masa monetaria", + "MONETARY_MASS_LABEL": "Masa monetaria", + "MONETARY_MASS_SHARE_LABEL": "Promedio miembro", + "UD_TITLE": "Evolución del dividendo universales", "MEMBERS_COUNT_TITLE": "Evolución del número de miembros", - "MEMBERS_COUNT_LABEL": "Número de miembros", - "MONETARY_MASS_TITLE": "Evolución de la masa monetaria ({{currency | currencySymbolNoHtml: false }})", - "MONETARY_MASS_TITLE_RELATIVE": "Evolución de la masa monetaria ({{currency | currencySymbolNoHtml: true }})", - "MONETARY_MASS_LABEL": "Masa monetaria" + "MEMBERS_COUNT_LABEL": "Número de miembros" } } } diff --git a/www/plugins/graph/i18n/locale-fr-FR.json b/www/plugins/graph/i18n/locale-fr-FR.json index c72aad2992c2ec7093fa96f830e626a8fe629f0b..2a38a89f41318a99354c53583b7ec098e07c54f3 100644 --- a/www/plugins/graph/i18n/locale-fr-FR.json +++ b/www/plugins/graph/i18n/locale-fr-FR.json @@ -8,7 +8,8 @@ "COMMON": { "LINEAR_SCALE" : "Echelle linéaire", "LOGARITHMIC_SCALE" : "Echelle logarithmique", - "BTN_SHOW_STATS": "Voir les statistiques" + "BTN_SHOW_STATS": "Voir les statistiques", + "BTN_SHOW_DETAILED_STATS": "Statistiques détaillées" }, "BLOCKCHAIN": { "TITLE": "Statistiques", @@ -17,9 +18,11 @@ "BLOCKS_ISSUERS_TITLE": "Nombre de blocs calculés par membre", "BLOCKS_ISSUERS_LABEL": "Nombre de blocs", "TX_DIVIDER": "Analyse des transactions", + "TX_AMOUNT_TITLE": "Volume des transactions", + "TX_AMOUNT_LABEL": "Volume échangé", "TX_COUNT_TITLE": "Nombre de transactions écrites", "TX_COUNT_LABEL": "Nombre de transactions", - "TX_AVG_BY_BLOCK": "Moyenne par bloc", + "TX_AVG_BY_BLOCK": "Nombre moyen de transactions / bloc", "TX_RANGE_DURATION": { "HOUR": "Regrouper par <b>heure</b>", "DAY": "Regrouper par <b>jour</b>", @@ -27,11 +30,12 @@ } }, "CURRENCY": { + "MONETARY_MASS_TITLE": "Evolution de la masse monétaire", + "MONETARY_MASS_LABEL": "Masse monétaire", + "MONETARY_MASS_SHARE_LABEL": "Moyenne par membre", + "UD_TITLE": "Evolution du dividende universel", "MEMBERS_COUNT_TITLE": "Evolution du nombre de membres", - "MEMBERS_COUNT_LABEL": "Nombre de membres", - "MONETARY_MASS_TITLE": "Evolution de la masse monétaire ({{currency | currencySymbolNoHtml: false }})", - "MONETARY_MASS_TITLE_RELATIVE": "Evolution de la masse monétaire ({{currency | currencySymbolNoHtml: true }})", - "MONETARY_MASS_LABEL": "Masse monétaire" + "MEMBERS_COUNT_LABEL": "Nombre de membres" } } } diff --git a/www/plugins/graph/i18n/locale-nl-NL.json b/www/plugins/graph/i18n/locale-nl-NL.json index ac392df47e15ee32e4967adf9762713d722f9128..9d82f597890fcd928069f5ce3ca16797f789f381 100644 --- a/www/plugins/graph/i18n/locale-nl-NL.json +++ b/www/plugins/graph/i18n/locale-nl-NL.json @@ -8,7 +8,8 @@ "COMMON": { "LINEAR_SCALE" : "Lineaire schaal", "LOGARITHMIC_SCALE" : "Logaritmische schaal", - "BTN_SHOW_STATS": "Zie statistieken" + "BTN_SHOW_STATS": "Zie statistieken", + "BTN_SHOW_DETAILED_STATS": "Gedetailleerde statistieken" }, "BLOCKCHAIN": { "TITLE": "Statistieken", @@ -17,9 +18,11 @@ "BLOCKS_ISSUERS_TITLE": "Aantal blokken berekend per lid", "BLOCKS_ISSUERS_LABEL": "Aantal blokken", "TX_DIVIDER": "Analyse van transacties", + "TX_AMOUNT_TITLE": "Trading volume", + "TX_AMOUNT_LABEL": "Verhandeld volume", "TX_COUNT_TITLE": "Aantal schriftelijke transacties", "TX_COUNT_LABEL": "Aantal transacties", - "TX_AVG_BY_BLOCK": "Gemiddeld per blok", + "TX_AVG_BY_BLOCK": "Gemiddeld aantal transacties / blok", "TX_RANGE_DURATION": { "HOUR": "Groep per <b>uur</b>", "DAY": "Groep per <b>dag</b>", @@ -27,11 +30,12 @@ } }, "CURRENCY": { + "MONETARY_MASS_TITLE": "Evolutie van de monetaire massa", + "MONETARY_MASS_LABEL": "Monetaire massa", + "MONETARY_MASS_SHARE_LABEL": "Gemiddelde leden", + "UD_TITLE": "Ontwikkeling van de universele dividend", "MEMBERS_COUNT_TITLE": "Evolutie van het aantal leden", - "MEMBERS_COUNT_LABEL": "Aantal leden", - "MONETARY_MASS_TITLE": "Evolutie van de monetaire massa ({{currency | currencySymbolNoHtml: false }})", - "MONETARY_MASS_TITLE_RELATIVE": "Evolutie van de monetaire massa ({{currency | currencySymbolNoHtml: true }})", - "MONETARY_MASS_LABEL": "Monetaire massa" + "MEMBERS_COUNT_LABEL": "Aantal leden" } } } diff --git a/www/plugins/graph/js/controllers/blockchain-controllers.js b/www/plugins/graph/js/controllers/blockchain-controllers.js index b2411ccb854845343fc84d1bf9cab4795b788d1e..8557f314a15993245589f890683d778b6b9ba9df 100644 --- a/www/plugins/graph/js/controllers/blockchain-controllers.js +++ b/www/plugins/graph/js/controllers/blockchain-controllers.js @@ -27,93 +27,19 @@ angular.module('cesium.graph.blockchain.controllers', ['chart.js', 'cesium.servi }) .controller('GpBlockchainTxCountCtrl', GpBlockchainTxCountController) - .controller('GpBlockchainIssuersCtrl', GpBlockchainIssuersController) ; -function GpBlockchainIssuersController($scope, $q, $translate, csCurrency, gpData) { - 'ngInject'; - $scope.loading = true; - - $scope.enter = function(e, state) { - if ($scope.loading) { - - if (state && state.stateParams && state.stateParams.currency) { // Currency parameter - $scope.currency = state.stateParams.currency; - } - - // Make sure there is currency, or load it not - if (!$scope.currency) { - return csCurrency.default() - .then(function(currency) { - $scope.currency = currency ? currency.name : null; - return $scope.enter(e, state); - }); - } - - $scope.load() - .then(function() { - $scope.loading = false; - }); - } - }; - $scope.$on('$ionicParentView.enter', $scope.enter); - - $scope.load = function() { - return $q.all([ - $translate([ - 'GRAPH.BLOCKCHAIN.BLOCKS_ISSUERS_TITLE', - 'GRAPH.BLOCKCHAIN.BLOCKS_ISSUERS_LABEL' - ]), - gpData.blockchain.countByIssuer($scope.currency) - ]) - .then(function(result) { - var translations = result[0]; - result = result[1]; - if (!result || !result.data) return; - - // Data - $scope.data = result.data; - $scope.blockCount = result.blockCount; - $scope.labels = result.labels; - - // Options - $scope.barOptions = { - responsive: true, - maintainAspectRatio: true, - title: { - display: true, - text: translations['GRAPH.BLOCKCHAIN.BLOCKS_ISSUERS_TITLE'] - }, - scales: { - yAxes: [{ - type: 'linear', - ticks: { - beginAtZero: true - } - }] - } - }; - - // Colors - $scope.colors = gpData.util.colors.custom(result.data.length); - - }); - }; - - $scope.setSize = function(height, width) { - $scope.height = height; - $scope.width = width; - }; -} - -function GpBlockchainTxCountController($scope, $q, $state, $translate, $ionicPopover, csCurrency, BMA, esHttp, gpData) { +function GpBlockchainTxCountController($scope, $q, $state, $filter, $translate, $ionicPopover, csSettings, csCurrency, BMA, esHttp, gpData) { 'ngInject'; $scope.loading = true; + $scope.height=undefined; + $scope.width=undefined; $scope.formData = { - timePct: 100 + timePct: 100, + useRelative: false /*csSettings.data.useRelative*/ }; // Default TX range duration @@ -158,7 +84,8 @@ function GpBlockchainTxCountController($scope, $q, $state, $translate, $ionicPop return $q.all([ // translate i18n keys - $translate(['GRAPH.BLOCKCHAIN.TX_COUNT_TITLE', + $translate(['GRAPH.BLOCKCHAIN.TX_AMOUNT_TITLE', + 'GRAPH.BLOCKCHAIN.TX_AMOUNT_LABEL', 'GRAPH.BLOCKCHAIN.TX_COUNT_LABEL', 'GRAPH.BLOCKCHAIN.TX_AVG_BY_BLOCK', 'COMMON.DATE_PATTERN', @@ -188,15 +115,21 @@ function GpBlockchainTxCountController($scope, $q, $state, $translate, $ionicPop if (!result || !result.times) return; // no data $scope.times = result.times; + var formatInteger = $filter('formatInteger'); + var formatAmount = $filter('formatDecimal'); + $scope.currencySymbol = $filter('currencySymbolNoHtml')($scope.currency, false/*$scope.formData.useRelative*/); + // Data if ($scope.txOptions.rangeDuration != 'hour') { $scope.data = [ + result.amount, result.count, result.avgByBlock ]; } else { $scope.data = [ + result.amount, result.count ]; } @@ -237,20 +170,32 @@ function GpBlockchainTxCountController($scope, $q, $state, $translate, $ionicPop maintainAspectRatio: true, title: { display: true, - text: translations['GRAPH.BLOCKCHAIN.TX_COUNT_TITLE'] + text: translations['GRAPH.BLOCKCHAIN.TX_AMOUNT_TITLE'] }, scales: { yAxes: [ { - id: 'y-axis-1', + id: 'y-axis-amount', type: 'linear', position: 'left', + ticks: { + beginAtZero:true, + callback: function(value) { + return formatInteger(value); + } + } + }, + { + id: 'y-axis-count', + display: false, + type: 'linear', + position: 'right', ticks: { beginAtZero:true } }, { - id: 'y-axis-2', + id: 'y-axis-avg', display: false, type: 'linear', position: 'right', @@ -259,39 +204,58 @@ function GpBlockchainTxCountController($scope, $q, $state, $translate, $ionicPop } } ] + }, + tooltips: { + enabled: true, + mode: 'index', + callbacks: { + label: function(tooltipItems, data) { + if (tooltipItems.datasetIndex === 0) { + return data.datasets[tooltipItems.datasetIndex].label + + ': ' + formatAmount(tooltipItems.yLabel) + + ' ' + $scope.currencySymbol; + } + return data.datasets[tooltipItems.datasetIndex].label + + ': ' + tooltipItems.yLabel; + } + } } }; $scope.datasetOverride = [ { - yAxisID: 'y-axis-1', + yAxisID: 'y-axis-amount', type: 'bar', - label: translations['GRAPH.BLOCKCHAIN.TX_COUNT_LABEL'] + label: translations['GRAPH.BLOCKCHAIN.TX_AMOUNT_LABEL'] }, { - yAxisID: 'y-axis-2', + yAxisID: 'y-axis-count', + type: 'line', + label: translations['GRAPH.BLOCKCHAIN.TX_COUNT_LABEL'], + fill: false, + borderColor: 'rgba(150,150,150,0.5)', + borderWidth: 2 + }, + { + yAxisID: 'y-axis-avg', type: 'line', - display: false, label: translations['GRAPH.BLOCKCHAIN.TX_AVG_BY_BLOCK'], - backgroundColor: 'rgba(17,193,243,0)', - borderColor: 'rgba(100,100,100,0.5)', - pointBackgroundColor: 'rgba(100,100,100,0.6)', - pointBorderColor: 'rgba(200,200,200,0.6)', - pointHoverBackgroundColor: 'rgba(17,193,243,0.8)' + fill: false, + showLine: false, + borderColor: 'rgba(0,0,0,0)', + pointBackgroundColor: 'rgba(0,0,0,0)', + pointBorderColor: 'rgba(0,0,0,0)', + pointHoverBackgroundColor: 'rgba(0,0,0,0)', + pointHoverBorderColor: 'rgba(0,0,0,0)' } ]; }); }; - $scope.setSize = function(height, width) { + $scope.setSize = function(height, width, maintainAspectRatio) { $scope.height = height; $scope.width = width; - }; - - $scope.showBlockIssuer = function(data, e, item) { - if (!item) return - var issuer = $scope.blocksByIssuer.issuers[item._index]; - $state.go('app.wot_identity', issuer); + $scope.maintainAspectRatio = angular.isDefined(maintainAspectRatio) ? maintainAspectRatio : $scope.maintainAspectRatio; }; $scope.showTxRange = function(data, e, item) { @@ -372,3 +336,93 @@ function GpBlockchainTxCountController($scope, $q, $state, $translate, $ionicPop } + +function GpBlockchainIssuersController($scope, $q, $state, $translate, csCurrency, gpData) { + 'ngInject'; + $scope.loading = true; + $scope.height = undefined; + $scope.width = undefined; + + $scope.enter = function(e, state) { + if ($scope.loading) { + + if (state && state.stateParams && state.stateParams.currency) { // Currency parameter + $scope.currency = state.stateParams.currency; + } + + // Make sure there is currency, or load it not + if (!$scope.currency) { + return csCurrency.default() + .then(function(currency) { + $scope.currency = currency ? currency.name : null; + return $scope.enter(e, state); + }); + } + + $scope.load() + .then(function() { + $scope.loading = false; + }); + } + }; + $scope.$on('$ionicParentView.enter', $scope.enter); + + $scope.load = function() { + return $q.all([ + $translate([ + 'GRAPH.BLOCKCHAIN.BLOCKS_ISSUERS_TITLE', + 'GRAPH.BLOCKCHAIN.BLOCKS_ISSUERS_LABEL' + ]), + gpData.blockchain.countByIssuer($scope.currency) + ]) + .then(function(result) { + var translations = result[0]; + result = result[1]; + if (!result || !result.data) return; + + // Data + $scope.data = result.data; + + // Labels + $scope.labels = result.labels; + + // Data to keep (for click or label) + $scope.blockCount = result.blockCount; + $scope.issuers = result.issuers; + + // Options + $scope.barOptions = { + responsive: true, + maintainAspectRatio: $scope.maintainAspectRatio, + title: { + display: true, + text: translations['GRAPH.BLOCKCHAIN.BLOCKS_ISSUERS_TITLE'] + }, + scales: { + yAxes: [{ + type: 'linear', + ticks: { + beginAtZero: true + } + }] + } + }; + + // Colors + $scope.colors = gpData.util.colors.custom(result.data.length); + + }); + }; + + $scope.setSize = function(height, width, maintainAspectRatio) { + $scope.height = height; + $scope.width = width; + $scope.maintainAspectRatio = angular.isDefined(maintainAspectRatio) ? maintainAspectRatio : $scope.maintainAspectRatio; + }; + + $scope.showBlockIssuer = function(data, e, item) { + if (!item) return; + var issuer = $scope.issuers[item._index]; + $state.go('app.wot_identity', issuer); + }; +} diff --git a/www/plugins/graph/js/controllers/currency-controllers.js b/www/plugins/graph/js/controllers/currency-controllers.js index db91b54f6bc071cc2f9285b7613171a7267603c0..80c5604859c2d8321c4b5c3227eded4cbdeefc8d 100644 --- a/www/plugins/graph/js/controllers/currency-controllers.js +++ b/www/plugins/graph/js/controllers/currency-controllers.js @@ -43,7 +43,7 @@ angular.module('cesium.graph.currency.controllers', ['chart.js', 'cesium.graph.s url: "/currency/stats/lg", views: { 'menuContent': { - templateUrl: "plugins/graph/templates/currency/view_stats.html" + templateUrl: "plugins/graph/templates/currency/view_stats_lg.html" } } }); @@ -83,6 +83,8 @@ angular.module('cesium.graph.currency.controllers', ['chart.js', 'cesium.graph.s .controller('GpCurrencyMonetaryMassCtrl', GpCurrencyMonetaryMassController) + .controller('GpCurrencyDUCtrl', GpCurrencyDUController) + .controller('GpCurrencyMembersCountCtrl', GpCurrencyMembersCountController) ; @@ -98,7 +100,7 @@ function GpCurrencyViewExtendController($scope, PluginService, UIUtils, esSettin }); } -function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, csCurrency, gpData, $filter, csSettings) { +function GpCurrencyMonetaryMassController($scope, $q, $state, $translate, $ionicPopover, csCurrency, gpData, $filter, csSettings) { 'ngInject'; $scope.loading = true; @@ -108,7 +110,9 @@ function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, csSettings.data.useRelative; $scope.height = undefined; $scope.width = undefined; + $scope.maintainAspectRatio = true; $scope.scale = 'linear'; + $scope.displayShareAxis = true; $scope.enter = function(e, state) { if ($scope.loading) { @@ -142,17 +146,18 @@ function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, }; $scope.$watch('formData.useRelative', $scope.onUseRelativeChanged); + var truncAmount = function(value) { + return Math.trunc(value*100)/100; + }; + $scope.load = function(from, size) { from = from || 0; size = size || 10000; return $q.all([ - $translate(['GRAPH.CURRENCY.MONETARY_MASS_LABEL']), - $translate($scope.formData.useRelative ? - 'GRAPH.CURRENCY.MONETARY_MASS_TITLE_RELATIVE' : - 'GRAPH.CURRENCY.MONETARY_MASS_TITLE', { - currency: $scope.formData.currency - }), + $translate(['GRAPH.CURRENCY.MONETARY_MASS_TITLE', + 'GRAPH.CURRENCY.MONETARY_MASS_LABEL', + 'GRAPH.CURRENCY.MONETARY_MASS_SHARE_LABEL']), gpData.blockchain.withDividend($scope.formData.currency, { from: from, size: size @@ -160,23 +165,58 @@ function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, ]) .then(function(result) { var translations = result[0]; - var title = result[1]; - result = result[2]; + result = result[1]; if (!result || !result.blocks) return; // Choose a date formatter, depending on the blocks period var blocksPeriod = result.blocks[result.blocks.length-1].medianTime - result.blocks[0].medianTime; - var dateFilter; + var formatDate; if (blocksPeriod < 15778800/* less than 6 months*/) { - dateFilter = $filter('formatDateShort'); + formatDate = $filter('formatDateShort'); } else { - dateFilter = $filter('formatDateMonth'); + formatDate = $filter('formatDateMonth'); } - // Format time + var formatAmount = $filter('formatDecimal'); + $scope.currencySymbol = $filter('currencySymbolNoHtml')($scope.formData.currency, $scope.formData.useRelative); + + // Data: relative + var data = []; + if($scope.formData.useRelative) { + + // Mass + data.push( + result.blocks.reduce(function(res, block) { + return res.concat(truncAmount(block.monetaryMass / block.dividend)); + }, [])); + + // M/N + data.push( + result.blocks.reduce(function(res, block) { + return res.concat(truncAmount(block.monetaryMass / block.dividend / block.membersCount)); + }, [])); + } + + // Data: quantitative + else { + // Mass + data.push( + result.blocks.reduce(function(res, block) { + return res.concat(block.monetaryMass / 100); + }, [])); + + // M/N + data.push( + result.blocks.reduce(function(res, block) { + return res.concat(truncAmount(block.monetaryMass / block.membersCount / 100)); + }, [])); + } + $scope.data = data; + + // Labels $scope.labels = result.labels.reduce(function(res, time) { - return res.concat(dateFilter(time)); + return res.concat(formatDate(time)); }, []); // Colors @@ -187,41 +227,51 @@ function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, // Options $scope.options = { responsive: true, - maintainAspectRatio: true, + maintainAspectRatio: $scope.maintainAspectRatio, title: { display: true, - text: title + text: translations['GRAPH.CURRENCY.MONETARY_MASS_TITLE'] }, scales: { - yAxes: [{ - id: 'y-axis-1' - }] + yAxes: [ + { + id: 'y-axis-mass' + }, + { + id: 'y-axis-mn', + display: $scope.displayShareAxis, + position: 'right' + } + ] + }, + tooltips: { + enabled: true, + mode: 'index', + callbacks: { + label: function(tooltipItems, data) { + return data.datasets[tooltipItems.datasetIndex].label + + ': ' + formatAmount(tooltipItems.yLabel) + + ' ' + $scope.currencySymbol; + } + } } }; $scope.setScale($scope.scale); - $scope.datasetOverride = [{ - yAxisID: 'y-axis-1', - type: 'bar', - label: translations['GRAPH.CURRENCY.MONETARY_MASS_LABEL'] - }]; - - // Data - if($scope.formData.useRelative) { - // If relative, divide by UD - $scope.data = [ - result.blocks.reduce(function(res, block) { - return res.concat(block.monetaryMass / block.dividend); - }, []) - ]; - } - else { - $scope.data = [ - result.blocks.reduce(function(res, block) { - return res.concat(block.monetaryMass/100); - }, []) - ]; - } + $scope.datasetOverride = [ + { + yAxisID: 'y-axis-mass', + type: 'bar', + label: translations['GRAPH.CURRENCY.MONETARY_MASS_LABEL'] + }, + { + yAxisID: 'y-axis-mn', + type: 'line', + label: translations['GRAPH.CURRENCY.MONETARY_MASS_SHARE_LABEL'], + fill: false, + borderColor: 'rgba(150,150,150,0.5)', + borderWidth: 2 + }]; // Keep only block number (need for click) $scope.blocks = result.blocks.reduce(function(res, block) { @@ -231,46 +281,39 @@ function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, }; - $scope.setMonetaryMassScale = function(scaleType) { - $scope.hideActionsPopover(); - $scope.options.scales.yAxes[0].type = scaleType; - if (scaleType == 'linear') { - $scope.options.scales.yAxes[0].ticks = { - beginAtZero: true - }; - } - else { - $scope.options.scales.yAxes[0].ticks = { - min: 0 - }; - } - }; - $scope.showBlock = function(data, e, item) { if (!item) return; var number = $scope.blocks[item._index]; $state.go('app.view_block', {number: number}); }; - $scope.setSize = function(height, width) { + $scope.setSize = function(height, width, maintainAspectRatio) { $scope.height = height; $scope.width = width; + $scope.maintainAspectRatio = angular.isDefined(maintainAspectRatio) ? maintainAspectRatio : $scope.maintainAspectRatio; }; - $scope.setScale = function(scaleType) { + $scope.setScale = function(scale) { $scope.hideActionsPopover(); - $scope.scale = scaleType; - $scope.options.scales.yAxes[0].type = scaleType; - if (scaleType == 'linear') { - $scope.options.scales.yAxes[0].ticks = { - beginAtZero: true - }; - } - else { - $scope.options.scales.yAxes[0].ticks = { - min: 0 + $scope.scale = scale; + + var format = $filter('formatInteger'); + + _.forEach($scope.options.scales.yAxes, function(yAxe) { + yAxe.type = scale; + yAxe.ticks = yAxe.ticks || {}; + if (scale == 'linear') { + yAxe.ticks.beginAtZero = true; + delete yAxe.ticks.min; + } + else { + yAxe.ticks.min = 0; + delete yAxe.ticks.beginAtZero; + } + yAxe.ticks.callback = function(value) { + return format(value); }; - } + }); }; /* -- Popover -- */ @@ -296,6 +339,109 @@ function GpCurrencyMonetaryMassController($scope, $q, $translate, $ionicPopover, }; } + +function GpCurrencyDUController($scope, $q, $controller, $translate, gpData, $filter) { + 'ngInject'; + // Initialize the super class and extend it. + angular.extend(this, $controller('GpCurrencyMonetaryMassCtrl', {$scope: $scope})); + + $scope.load = function(from, size) { + from = from || 0; + size = size || 10000; + + return $q.all([ + $translate([ + 'GRAPH.CURRENCY.UD_TITLE', + 'COMMON.UNIVERSAL_DIVIDEND']), + gpData.blockchain.withDividend($scope.formData.currency, { + from: from, + size: size + }) + ]) + .then(function(result) { + var translations = result[0]; + result = result[1]; + if (!result || !result.blocks) return; + + // Choose a date formatter, depending on the blocks period + var blocksPeriod = result.blocks[result.blocks.length-1].medianTime - result.blocks[0].medianTime; + var dateFilter; + if (blocksPeriod < 15778800/* less than 6 months*/) { + dateFilter = $filter('formatDateShort'); + } + else { + dateFilter = $filter('formatDateMonth'); + } + + var formatAmount = $filter('formatDecimal'); + $scope.currencySymbol = $filter('currencySymbolNoHtml')($scope.formData.currency, false); + + // Data + $scope.data = [ + result.blocks.reduce(function(res, block) { + return res.concat(block.dividend / 100); + }, []) + ]; + + // Labels + $scope.labels = result.labels.reduce(function(res, time) { + return res.concat(dateFilter(time)); + }, []); + + // Colors + $scope.colors = result.blocks.reduce(function(res) { + return res.concat('rgba(17,193,243,0.5)'); + }, []); + + // Options + $scope.options = { + responsive: true, + maintainAspectRatio: $scope.maintainAspectRatio, + title: { + display: true, + text: translations['GRAPH.CURRENCY.UD_TITLE'] + }, + scales: { + yAxes: [ + { + id: 'y-axis-ud', + ticks: { + beginAtZero: true + } + } + ] + }, + tooltips: { + enabled: true, + mode: 'index', + callbacks: { + label: function(tooltipItems, data) { + return data.datasets[tooltipItems.datasetIndex].label + + ': ' + formatAmount(tooltipItems.yLabel) + + ' ' + $scope.currencySymbol; + } + } + } + }; + $scope.setScale($scope.scale); + + $scope.datasetOverride = [ + { + yAxisID: 'y-axis-ud', + type: 'bar', + label: translations['COMMON.UNIVERSAL_DIVIDEND'] + }]; + + // Keep only block number (need for click) + $scope.blocks = result.blocks.reduce(function(res, block) { + return res.concat(block.number); + }, []); + }); + + }; +} + + function GpCurrencyMembersCountController($scope, $q, $state, $translate, csCurrency, gpData, $filter) { 'ngInject'; @@ -303,6 +449,7 @@ function GpCurrencyMembersCountController($scope, $q, $state, $translate, csCurr $scope.formData = $scope.formData || {}; $scope.height = undefined; $scope.width = undefined; + $scope.maintainAspectRatio = true; $scope.enter = function(e, state) { if ($scope.loading) { @@ -363,7 +510,7 @@ function GpCurrencyMembersCountController($scope, $q, $state, $translate, csCurr // Members count graph: ------------------------- $scope.options = { responsive: true, - maintainAspectRatio: true, + maintainAspectRatio: $scope.maintainAspectRatio, title: { display: true, text: translations['GRAPH.CURRENCY.MEMBERS_COUNT_TITLE'] @@ -418,9 +565,10 @@ function GpCurrencyMembersCountController($scope, $q, $state, $translate, csCurr }); }; - $scope.setSize = function(height, width) { + $scope.setSize = function(height, width, maintainAspectRatio) { $scope.height = height; $scope.width = width; + $scope.maintainAspectRatio = angular.isDefined(maintainAspectRatio) ? maintainAspectRatio : $scope.maintainAspectRatio; }; } diff --git a/www/plugins/graph/js/services/data-services.js b/www/plugins/graph/js/services/data-services.js index c7afcb6d88bef6f43f16a4b0bbe0040f89e18303..eb96bc3b814b2a3d4779d20bf6d27cea694c8714 100644 --- a/www/plugins/graph/js/services/data-services.js +++ b/www/plugins/graph/js/services/data-services.js @@ -13,13 +13,17 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. }, raw: { block: { - search: esHttp.post('/:currency/block/_search?pretty') + search: esHttp.post('/:currency/block/_search') + }, + blockStat: { + search: esHttp.post('/:currency/blockStat/_search?pretty') } }, regex: { } }; + /** * Compute colors scale * @param count @@ -184,6 +188,10 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. } } + function _powBase(amount, base) { + return base <= 0 ? amount : amount * Math.pow(10, base); + } + var request = { query: { filtered: { @@ -202,7 +210,7 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. }, size: options.size || 10000, from: options.from || 0, - _source: ["medianTime", "number", "dividend", "monetaryMass", "membersCount"], + _source: ["medianTime", "number", "dividend", "monetaryMass", "membersCount", "unitbase"], sort: { "medianTime" : "asc" } @@ -214,7 +222,13 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. var result = {}; result.blocks = res.hits.hits.reduce(function(res, hit){ - return res.concat(hit._source); + var block = hit._source; + + // Apply unitbase on dividend + block.dividend = _powBase(block.dividend, block.unitbase); + delete block.unitbase; + + return res.concat(block); }, []); result.labels = res.hits.hits.reduce(function(res, hit){ return res.concat(hit._source.medianTime); @@ -261,18 +275,20 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. var request = { size: 0, aggs: { - txCount: { + tx: { range: { field: "medianTime", ranges: ranges }, aggs: { - tx_stats : { + txCount : { + stats: { + field : "txCount" + } + }, + txAmount : { stats: { - script : { - inline: "txcount", - lang: "native" - } + field : "txAmount" } } } @@ -286,21 +302,18 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. if (jobs.length < 10) { jobs.push( - exports.raw.block.search(request, {currency: currency}) + exports.raw.blockStat.search(request, {currency: currency}) .then(function (res) { var aggs = res.aggregations; - if (!aggs.txCount || !aggs.txCount.buckets || !aggs.txCount.buckets.length) return; - //var started = false; - return (aggs.txCount.buckets || []).reduce(function (res, agg) { - /*if (!started) { - started = agg.tx_stats.count > 0; - }*/ - return /*!started ? res : */res.concat({ + if (!aggs.tx || !aggs.tx.buckets || !aggs.tx.buckets.length) return; + return (aggs.tx.buckets || []).reduce(function (res, agg) { + return res.concat({ from: agg.from, to: agg.to, - count: agg.tx_stats.sum, - avgByBlock: Math.round(agg.tx_stats.avg * 100) / 100, - maxByBlock: agg.tx_stats.max + count: agg.txCount.sum||0, + amount: agg.txAmount.sum || 0, + avgByBlock: Math.round(agg.txCount.avg * 100) / 100, + maxByBlock: agg.txCount.max }); }, []); }) @@ -333,6 +346,9 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es. result.maxByBlock = res.reduce(function(res, hit){ return res.concat(hit.maxByBlock); }, []); + result.amount = res.reduce(function(res, hit){ + return res.concat(hit.amount/100); + }, []); result.times = res.reduce(function(res, hit){ return res.concat(hit.from); }, []); diff --git a/www/plugins/graph/templates/blockchain/graph_block_issuers.html b/www/plugins/graph/templates/blockchain/graph_block_issuers.html index 5824e6de778fbdb5cb9e9228f0b2f1e7426ef29f..81ef7618a48a95fc40f396c33d63e60426977b49 100644 --- a/www/plugins/graph/templates/blockchain/graph_block_issuers.html +++ b/www/plugins/graph/templates/blockchain/graph_block_issuers.html @@ -16,7 +16,6 @@ <!-- pie --> <div class="col col-25 padding-top"> <canvas id="blocksByIssuer-pie" class="chart-pie" - style="max-height: 300px; max-width: 300px;" chart-data="data" chart-labels="labels" chart-colors="colors" diff --git a/www/plugins/graph/templates/blockchain/graph_tx_count.html b/www/plugins/graph/templates/blockchain/graph_tx_count.html index 3c3f7a261709341e868111bffca8799275b3c391..93ea3734bd20d56567ec3feae2277451c91f640a 100644 --- a/www/plugins/graph/templates/blockchain/graph_tx_count.html +++ b/www/plugins/graph/templates/blockchain/graph_tx_count.html @@ -9,17 +9,19 @@ </button> </div> - <canvas id="tx-line" class="chart-bar" height="300" width="1000" - height="{{height}}" width="{{width}}" - chart-data="data" - chart-dataset-override="datasetOverride" - chart-colors="colors" - chart-options="options" - chart-labels="labels" - chart-click="showTxRange"> - </canvas> + <div class="padding-left padding-right"> + <canvas id="tx-line" class="chart-bar" + height="{{height}}" width="{{width}}" + chart-data="data" + chart-dataset-override="datasetOverride" + chart-colors="colors" + chart-options="options" + chart-labels="labels" + chart-click="showTxRange"> + </canvas> + </div> - <div class="range range-positive padding"> + <div class="range range-positive no-padding-left no-padding-right"> <a class="button button-stable button-clear no-padding pull-left" ng-click="loadPreviousTx()"> diff --git a/www/plugins/graph/templates/currency/graph_du.html b/www/plugins/graph/templates/currency/graph_du.html new file mode 100644 index 0000000000000000000000000000000000000000..2b34a02ac999b5c537c9ce34b5e15ea3bd8dd750 --- /dev/null +++ b/www/plugins/graph/templates/currency/graph_du.html @@ -0,0 +1,21 @@ + + <!-- graphs button bar --> + <div class="button-bar-inline " + style="top: 33px; margin-top:-33px; position: relative;"> + <button + class="button button-stable button-clear no-padding-xs pull-right" + ng-click="showActionsPopover($event)"> + <i class="icon ion-navicon-round"></i> + </button> + </div> + + <canvas id="monetaryMass-bar" class="chart-bar" + height="{{height}}" + width="{{width}}" + chart-data="data" + chart-labels="labels" + chart-colors="colors" + chart-dataset-override="datasetOverride" + chart-options="options" + chart-click="showBlock"> + </canvas> diff --git a/www/plugins/graph/templates/currency/tabs/tab_blocks_stats.html b/www/plugins/graph/templates/currency/tabs/tab_blocks_stats.html index a3f252debf0af6fc948243aef1b1c6631ed42e1f..dfe962a0be6c83205d13e4c35fd9c4e8af4bb016 100644 --- a/www/plugins/graph/templates/currency/tabs/tab_blocks_stats.html +++ b/www/plugins/graph/templates/currency/tabs/tab_blocks_stats.html @@ -1,12 +1,9 @@ <ion-view> <ion-content> - - <div class="list"> - <div class="item" - ng-include="'plugins/graph/templates/blockchain/graph_tx_count.html'" - ng-controller="GpBlockchainTxCountCtrl" - ng-init="setSize(undefined,undefined)"> + <div + ng-include="'plugins/graph/templates/blockchain/graph_tx_count.html'" + ng-controller="GpBlockchainTxCountCtrl" + ng-init="setSize(500,700,false)"> </div> - </div> </ion-content> </ion-view> diff --git a/www/plugins/graph/templates/currency/tabs/tab_network_stats.html b/www/plugins/graph/templates/currency/tabs/tab_network_stats.html index 83c89d95d376beb495bc368f436923bf8095b58c..ffa8acb631345ea85bd35e604ea736c240e15bba 100644 --- a/www/plugins/graph/templates/currency/tabs/tab_network_stats.html +++ b/www/plugins/graph/templates/currency/tabs/tab_network_stats.html @@ -5,7 +5,7 @@ <div class="item" ng-include="'plugins/graph/templates/blockchain/graph_block_issuers.html'" ng-controller="GpBlockchainIssuersCtrl" - ng-init="setSize(undefined,undefined)"> + ng-init="setSize(500,700,true)"> </div> </div> </ion-content> diff --git a/www/plugins/graph/templates/currency/tabs/tab_parameters_stats.html b/www/plugins/graph/templates/currency/tabs/tab_parameters_stats.html index 582fba188ae42c67df8449dd59128c38195ee0cb..2be6dcc1a12a4269aec105d0b0f7cc9179ad4506 100644 --- a/www/plugins/graph/templates/currency/tabs/tab_parameters_stats.html +++ b/www/plugins/graph/templates/currency/tabs/tab_parameters_stats.html @@ -4,9 +4,17 @@ <ion-spinner icon="android"></ion-spinner> </div> - <div class="list"> - <div class="item" - ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'"> + <div class="row responsive-sm"> + <div class="col" + ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'" + ng-init="setSize(500,700,true)"> + </div> + + <!-- DU --> + <div class="col" + ng-include="'plugins/graph/templates/currency/graph_du.html'" + ng-controller="GpCurrencyDUCtrl" + ng-init="setSize(500,700,true)"> </div> </div> </ion-content> diff --git a/www/plugins/graph/templates/currency/tabs/tab_wot_stats.html b/www/plugins/graph/templates/currency/tabs/tab_wot_stats.html index 825bbf0398890ea6d2161ffc360304c2b677e93d..c058e990402f35fb43fcb3ca5bdad8ee61060bb5 100644 --- a/www/plugins/graph/templates/currency/tabs/tab_wot_stats.html +++ b/www/plugins/graph/templates/currency/tabs/tab_wot_stats.html @@ -4,9 +4,10 @@ <ion-spinner icon="android"></ion-spinner> </div> - <div class="list"> - <div class="item" - ng-include="'plugins/graph/templates/currency/graph_members_count.html'"> + <div class="list no-padding"> + <div class="item no-padding-top" + ng-include="'plugins/graph/templates/currency/graph_members_count.html'" + ng-init="setSize(600,700,false)"> </div> </div> </ion-content> diff --git a/www/plugins/graph/templates/currency/view_currency_extend.html b/www/plugins/graph/templates/currency/view_currency_extend.html index 858755f1953bcbcc29cb3ac54ac15f118639d486..dc99c2799d0b76a554c2d129b0a3cc6747c73762 100644 --- a/www/plugins/graph/templates/currency/view_currency_extend.html +++ b/www/plugins/graph/templates/currency/view_currency_extend.html @@ -2,11 +2,19 @@ <!-- section actual parameters --> <ng-if ng-if="enable && extensionPoint === 'parameters-actual'" > - <div class="item padding-left padding-right no-padding-xs" - ng-if="!smallscreen" - ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'" - ng-controller="GpCurrencyMonetaryMassCtrl"> - </div> + <ng-if ng-if="!smallscreen"> + <div class="item padding-left padding-right no-padding-xs" + ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'" + ng-controller="GpCurrencyMonetaryMassCtrl" + ng-init="displayShareAxis=false;"> + </div> + <div class="item buttons no-padding-top "> + <a class="pull-right button button-text button-small button-small-padding ink" ui-sref="app.currency_stats_lg"> + <i class="icon ion-stats-bars"></i> + <span translate>GRAPH.COMMON.BTN_SHOW_DETAILED_STATS</span> + </a> + </div> + </ng-if> <div class="item item-divider" ng-if="smallscreen"> @@ -20,11 +28,18 @@ <!-- section Wot --> <ng-if ng-if="enable && extensionPoint === 'wot-actual'" > - <div class="item padding-left padding-right no-padding-xs" - ng-if="!smallscreen" - ng-include="'plugins/graph/templates/currency/graph_members_count.html'" - ng-controller="GpCurrencyMembersCountCtrl"> - </div> + <ng-if ng-if="!smallscreen"> + <div class="item padding-left padding-right no-padding-xs" + ng-include="'plugins/graph/templates/currency/graph_members_count.html'" + ng-controller="GpCurrencyMembersCountCtrl"> + </div> + <div class="item buttons no-padding-top "> + <a class="pull-right button button-text button-small button-small-padding ink" ui-sref="app.currency_stats_lg"> + <i class="icon ion-stats-bars"></i> + <span translate>GRAPH.COMMON.BTN_SHOW_DETAILED_STATS</span> + </a> + </div> + </ng-if> <div class="item item-divider" ng-if="smallscreen"> diff --git a/www/plugins/graph/templates/currency/view_parameters_stats.html b/www/plugins/graph/templates/currency/view_parameters_stats.html index 3c88780c5cd62f39f0980da00dfd1883a40c5ad1..9108dfbf6bb5e75aae03723f554c3327843bc8ba 100644 --- a/www/plugins/graph/templates/currency/view_parameters_stats.html +++ b/www/plugins/graph/templates/currency/view_parameters_stats.html @@ -7,6 +7,17 @@ <ion-spinner icon="android"></ion-spinner> </div> - <ng-include src="'plugins/graph/templates/currency/graph_monetary_mass.html'" ></ng-include> + <div class="list no-padding-xs"> + <div class="item no-padding-xs" + ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'"> + </div> + + <!-- DU --> + <div class="item no-padding-xs" + ng-include="'plugins/graph/templates/currency/graph_du.html'" + ng-controller="GpCurrencyDUCtrl" + ng-init="setSize(undefined, undefined)"> + </div> + </div> </ion-content> </ion-view> diff --git a/www/plugins/graph/templates/currency/view_stats.html b/www/plugins/graph/templates/currency/view_stats_lg.html similarity index 70% rename from www/plugins/graph/templates/currency/view_stats.html rename to www/plugins/graph/templates/currency/view_stats_lg.html index 26cc7efd77af44b852de9b40137225ee35bd6c93..15d0dd788a3ae0f047cc29835647437fb936b46d 100644 --- a/www/plugins/graph/templates/currency/view_stats.html +++ b/www/plugins/graph/templates/currency/view_stats_lg.html @@ -7,10 +7,12 @@ <ion-content scroll="true" class="padding" > <div class="list" > - <ng-controller ng-controller="GpCurrencyMonetaryMassCtrl" - ng-init="setSize(300, 1000)"> + + <!-- Monetary mass --> + <ng-controller ng-controller="GpCurrencyMonetaryMassCtrl"> <div class="item no-padding-xs" - ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'"> + ng-include="'plugins/graph/templates/currency/graph_monetary_mass.html'" + ng-init="setSize(250, 1000)"> </div> <div class="item item-toggle dark no-border text-right"> @@ -24,10 +26,17 @@ </div> </ng-controller> + <!-- DU --> + <div class="item no-padding-xs" + ng-include="'plugins/graph/templates/currency/graph_du.html'" + ng-controller="GpCurrencyDUCtrl" + ng-init="setSize(250, 1000)"> + </div> + <div class="item no-padding-xs" ng-include="'plugins/graph/templates/currency/graph_members_count.html'" ng-controller="GpCurrencyMembersCountCtrl" - ng-init="setSize(300, 1000)"> + ng-init="setSize(250, 1000)"> </div>