From 6936291c208a529d220e6715c03c488f1a7d4faf Mon Sep 17 00:00:00 2001 From: MineMoneroPRO Date: Tue, 4 Jul 2017 19:46:30 +0300 Subject: [PATCH] PPLNS pool historical charts for hashrate and miner's count on the home page. Fixed worker's graph when it personal checkbox is flagged. --- app/app.css | 9 ++++++ app/app.js | 2 ++ app/user/home/home.html | 23 +++++++++++++ app/user/home/home.js | 71 ++++++++++++++++++++++++++++++++++++++++- app/utils/services.js | 2 +- 5 files changed, 105 insertions(+), 2 deletions(-) diff --git a/app/app.css b/app/app.css index 7fdf73d..7dec0a2 100644 --- a/app/app.css +++ b/app/app.css @@ -181,6 +181,15 @@ md-tooltip .md-content { height:300px; } +.chartcontainer-pool { + width: 100% !important; + height: 150px; +} + +.chartcontainer-pool .ng-isolate-scope { + height:150px; +} + /* LOGIN WINDOW */ md-dialog .login{ min-width: 800px !important; diff --git a/app/app.js b/app/app.js index 6e12c81..2adf86c 100644 --- a/app/app.js +++ b/app/app.js @@ -79,6 +79,8 @@ var app = angular.module('poolui', [ $scope.poolList = ["pplns", "pps", "solo"]; $scope.poolStats = {}; // All Pool stats + $scope.poolHashrateChart = {}; // hashrate history + $scope.poolMinersChart = {}; // miners history $scope.addrStats = {}; // All tracked addresses $scope.lastBlock = {}; diff --git a/app/user/home/home.html b/app/user/home/home.html index 0b4adcb..7d15635 100644 --- a/app/user/home/home.html +++ b/app/user/home/home.html @@ -1,4 +1,27 @@ +
+ + + Historical Pool Hashrate + + +
+ +
+
+
+ + + + Historical Pool Miners + + +
+ +
+
+
+
diff --git a/app/user/home/home.js b/app/user/home/home.js index 6275a5a..d429216 100644 --- a/app/user/home/home.js +++ b/app/user/home/home.js @@ -1,5 +1,74 @@ 'use strict'; app.controller('HomeCtrl', function($scope, $route, dataService, timerService) { - + + function ticker() { + dataService.getData("/pool/chart/hashrate/pplns", function(data){ + + data = _.forEach(data, function(element) { + element.ts = new Date(element.ts); + }); + + $scope.poolHashrateChart = { + datasets: { global: data }, + options: { + series: [ + {"axis":"y","id":"global","dataset":"global","label":"Total Pool Hashrate","key":"hs","color":"green","type":["line","area"]} + ], + allSeries: [], + axes: { + x: { + key: "ts", + type: "date" + }, + y: { + min: 0 + } + } + } + } + }); + } + + function ticker2() { + dataService.getData("/pool/chart/miners", function(data){ + + data = _.forEach(data, function(element) { + element.ts = new Date(element.ts); + }); + + $scope.poolMinersChart = { + datasets: { global: data }, + options: { + series: [ + {"axis":"y","id":"global","dataset":"global","label":"Total Pool Miners","key":"cn","color":"green","type":["line","area"]} + ], + allSeries: [], + axes: { + x: { + key: "ts", + type: "date" + }, + y: { + min: 0 + } + } + } + } + }); + } + + timerService.register(ticker, 'poolHashrateChart'); + ticker(); + + timerService.register(ticker2, 'poolMinersChart'); + ticker2(); + + $scope.$on("$routeChangeStart", function () { + timerService.remove("poolHashrateChart"); + }); + + $scope.$on("$routeChangeStart", function () { + timerService.remove("poolMinersChart"); + }); }); \ No newline at end of file diff --git a/app/utils/services.js b/app/utils/services.js index b3f5cb6..a432c67 100644 --- a/app/utils/services.js +++ b/app/utils/services.js @@ -156,7 +156,7 @@ angular.module('utils.services', []) }); // only display selected miners - var selected = minerStats[addr].selected; + var selected = minerStats[addr].table_selected; if(minerStats[addr].table_selected.length < 1) { selected = _.union(minerStats[addr].table_selected, ['global']); }