Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPLNS pool historical charts for hashrate and miner's count on the home page. Fixed worker's graph when it personal checkbox is flagged. #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

Expand Down
23 changes: 23 additions & 0 deletions app/user/home/home.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<ng-include src="'user/dashboard/poolstats.html'"></ng-include>
<div layout="column" layout-gt-sm="row" flex>
<md-card flex>
<md-card-title>
<span class="md-headline">Historical Pool Hashrate</span>
</md-card-title>
<md-card-content layout="column">
<div class="chartcontainer-pool" flex>
<linechart data="poolHashrateChart.datasets" options="poolHashrateChart.options"></linechart>
</div>
</md-card-content>
</md-card>

<md-card flex>
<md-card-title>
<span class="md-headline">Historical Pool Miners</span>
</md-card-title>
<md-card-content layout="column">
<div class="chartcontainer-pool" flex>
<linechart data="poolMinersChart.datasets" options="poolMinersChart.options"></linechart>
</div>
</md-card-content>
</md-card>
</div>
<div layout="column" layout-gt-md="row" flex>
<md-card flex ng-include="'welcome.html'">
</md-card>
Expand Down
71 changes: 70 additions & 1 deletion app/user/home/home.js
Original file line number Diff line number Diff line change
@@ -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");
});
});
2 changes: 1 addition & 1 deletion app/utils/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down