[UPDATE] hashrate graphs

This commit is contained in:
iAmShorty 2014-02-28 23:04:39 +01:00
parent 9a949dbbb1
commit b0d9e1acd2
7 changed files with 173 additions and 81 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
<!--[if IE 7]><link rel="stylesheet" href="css/fontello-ie7.css"><![endif]-->
<!--<link rel="stylesheet" href="{$PATH}/css/visualize.css" type="text/css" media="screen" />-->
<!--<link rel="stylesheet" href="{$PATH}/css/custom.css" type="text/css" media="screen" />-->
<link rel="stylesheet" href="{$PATH}/css/jquery.jqplot.min.css" type="text/css" media="screen" />
<!--<link rel="stylesheet" href="{$PATH}/css/jquery.jqplot.min.css" type="text/css" media="screen" />-->
<!--[if lt IE 9]>
<link rel="stylesheet" href="{$PATH}/css/ie.css" type="text/css" media="screen" />
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@ -21,11 +21,11 @@
<script type="text/javascript" src="{$PATH}/js/hideshow.js" type="text/javascript"></script>
<script type="text/javascript" src="{$PATH}/js/jquery.visualize.js"></script>
<script type="text/javascript" src="{$PATH}/js/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="{$PATH}/js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript" src="{$PATH}/js/jquery.tablesorter.pager.js" type="text/javascript"></script>
<script type="text/javascript" src="{$PATH}/js/jquery.tablesorter.min.js" type="text/javascript"></script
script type="text/javascript" src="{$PATH}/js/jquery.tablesorter.pager.js" type="text/javascript"></script>
<script type="text/javascript" src="{$PATH}/js/jquery.equalHeight.js"></script>
<script type="text/javascript" src="{$PATH}/js/raphael.2.1.2.min.js"></script>
<script type="text/javascript" src="{$PATH}/js/justgage.1.0.1.min.js"></script>
<!--<script type="text/javascript" src="{$PATH}/js/raphael.2.1.2.min.js"></script>-->
<!--<script type="text/javascript" src="{$PATH}/js/justgage.1.0.1.min.js"></script>-->
<script type="text/javascript" src="{$PATH}/js/custom.js"></script>
<script type="text/javascript" src="{$PATH}/js/tinybox.js"></script>
<script type="text/javascript" src="{$PATH}/../global/js/number_format.js"></script>
@ -42,7 +42,7 @@
<link href="{$PATH}/css/plugins/morris/morris-0.4.3.min.css" rel="stylesheet">
<link href="{$PATH}/css/plugins/timeline/timeline.css" rel="stylesheet">
<link href="{$PATH}/css/mpos.css" rel="stylesheet">
</head>
<body>
@ -72,11 +72,17 @@
<script src="{$PATH}/js/jquery-1.10.2.js"></script>
<script src="{$PATH}/js/bootstrap.min.js"></script>
<script src="{$PATH}/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="{$PATH}/js/plugins/morris/raphael-2.1.0.min.js"></script>
<!-- Page-Level Plugin Scripts - Flot -->
<script src="{$PATH}/js/plugins/flot/jquery.flot.js"></script>
<script src="{$PATH}/js/plugins/flot/jquery.flot.tooltip.min.js"></script>
<script src="{$PATH}/js/plugins/flot/jquery.flot.resize.js"></script>
<script src="{$PATH}/js/plugins/flot/jquery.flot.pie.js"></script>
<script src="{$PATH}/js/plugins/morris/raphael-2.1.0.min.js"></script>
<!-- Page-Level Plugin Scripts - Morris -->
<script src="{$PATH}/js/plugins/morris/morris.js"></script>
<script src="{$PATH}/js/mpos.js"></script>
<script type="text/javascript" src="{$PATH}/js/justgage.1.0.1.min.js"></script>

View File

@ -1,29 +1,46 @@
<!--
{if is_array($YOURHASHRATES) && is_array($POOLHASHRATES)}
<div class="tab_content" id="both">
<table class="visualize" rel="area">
<caption>Your vs Pool Hashrate</caption>
<thead>
<tr>
<td></td>
<div class="tab-pane fade in" id="both">
<div class="panel-heading">
Your vs Pool Hashrate
</div>
<div class="panel-body">
<table class="visualize" rel="area">
<thead>
<tr>
<td></td>
{foreach $YOURHASHRATES as $hour=>$hashrate}
<th scope="col">{$hour|default:"0"}:00</th>
<th scope="col">{$hour|default:"0"}:00</th>
{/foreach}
</tr>
</thead>
<tbody>
<tr>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">{$smarty.session.USERDATA.username}</th>
{foreach $YOURHASHRATES as $hour=>$hashrate}
<td>{$hashrate|default:"0"}</td>
<td>{$hashrate|default:"0"}</td>
{/foreach}
</tr>
<tr>
<th scope="row">Pool</th>
</tr>
<tr>
<th scope="row">Pool</th>
{foreach $POOLHASHRATES as $hour=>$hashrate}
<td>{$hashrate|default:"0"}</td>
<td>{$hashrate|default:"0"}</td>
{/foreach}
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
<div id="both-area-chart"></div>
</div>
</div>
{/if}
-->
{if is_array($YOURHASHRATES) && is_array($POOLHASHRATES)}
<div class="tab-pane fade in" id="both">
<div class="panel-heading">
Your vs. Pool Hashrate
</div>
<div class="panel-body">
<div id="both-area-chart"></div>
</div>
</div>
{/if}

View File

@ -1,15 +1,103 @@
<article class="module width_full">
<header>
<h3 class="tabs_involved">Stats</h3>
<ul class="tabs">
<li><a href="#mine">Mine</a></li>
<li><a href="#pool">Pool</a></li>
<li><a href="#both">Both</a></li>
</ul>
</header>
<div class="tab_container">
{include file="{$smarty.request.page|escape}/{$smarty.request.action|escape}/mine.tpl"}
{include file="{$smarty.request.page|escape}/{$smarty.request.action|escape}/pool.tpl"}
{include file="{$smarty.request.page|escape}/{$smarty.request.action|escape}/both.tpl"}
<script>
$(function () {
// You can't draw here chart directly, because it's on hidden tab, instead let's do the workaround
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// this ain't pretty, but you should get the idea
if ($(e.target).attr('href') == '#pool' && $('#pool-area-chart').html().length == 0) {
Morris.Area({
element: 'pool-area-chart',
data: [
{foreach $POOLHASHRATES as $hour=>$hashrate}
{
period: '{$hour|default:"0"}:00',
Pool: '{$hashrate|default:"0"}',
},
{/foreach}
],
xkey: 'period',
ykeys: ['Pool'],
labels: ['Hashrate'],
pointSize: 2,
hideHover: 'auto',
lineColors: ['#0b62a4'],
pointFillColors: ['#FFFFFF'],
resize: true
});
}
if ($(e.target).attr('href') == '#mine' && $('#mine-area-chart').html().length == 0) {
Morris.Area({
element: 'mine-area-chart',
data: [
{foreach $YOURHASHRATES as $yourhour=>$yourhashrate}
{
period: '{$yourhour|default:"0"}:00',
Mine: '{$yourhashrate|default:"0"}',
},
{/foreach}
],
xkey: 'period',
ykeys: ['Mine'],
labels: ['Hashrate'],
pointSize: 2,
hideHover: 'auto',
lineColors: ['#24A665'],
pointFillColors: ['#FFFFFF'],
resize: true
});
}
if ($(e.target).attr('href') == '#both' && $('#both-area-chart').html().length == 0) {
Morris.Area({
element: 'both-area-chart',
data: [
{foreach $YOURHASHRATES as $yourhour=>$yourhashrate}
{
period: '{$yourhour|default:"0"}:00',
Mine: '{$yourhashrate|default:"0"}',
{foreach $POOLHASHRATES as $poolhour=>$poolhashrate}
{if $yourhour eq $poolhour}
Pool: '{$poolhashrate|default:"0"}',
{/if}
{/foreach}
},
{/foreach}
],
xkey: 'period',
ykeys: ['Mine', 'Pool'],
labels: ['Your Hashrate', 'Pool Hashrate'],
pointSize: 2,
hideHover: 'auto',
resize: true
});
}
});
});
</script>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
Stats
</div>
<div class="panel-body">
<ul class="nav nav-pills" id="hashrategraph">
<li><a href="#mine" data-toggle="tab">Mine</a></li>
<li><a href="#pool" data-toggle="tab">Pool</a></li>
<li><a href="#both" data-toggle="tab">Both</a></li>
</ul>
<div class="tab-content">
{include file="{$smarty.request.page|escape}/{$smarty.request.action|escape}/mine.tpl"}
{include file="{$smarty.request.page|escape}/{$smarty.request.action|escape}/pool.tpl"}
{include file="{$smarty.request.page|escape}/{$smarty.request.action|escape}/both.tpl"}
</div>
</div>
</div>
</div>
</article>
</div>

View File

@ -1,23 +1,10 @@
{if is_array($YOURHASHRATES)}
<div class="tab_content" id="mine">
<table class="visualize" rel="area">
<caption>Your Hashrate</caption>
<thead>
<tr>
<td></td>
{foreach $YOURHASHRATES as $hour=>$hashrate}
<th scope="col">{$hour|default:"0"}:00</th>
{/foreach}
</tr>
</thead>
<tbody>
<tr>
<th scope="row">{$smarty.session.USERDATA.username}</th>
{foreach $YOURHASHRATES as $hour=>$hashrate}
<td>{$hashrate|default:"0"}</td>
{/foreach}
</tr>
</tbody>
</table>
<div class="tab-pane fade in" id="mine">
<div class="panel-heading">
Your Hashrate
</div>
<div class="panel-body">
<div id="mine-area-chart"></div>
</div>
</div>
{/if}

View File

@ -1,23 +1,10 @@
{if is_array($POOLHASHRATES)}
<div class="tab_content" id="pool">
<table class="visualize" rel="area">
<caption>Pool Hashrate</caption>
<thead>
<tr>
<td></td>
{foreach $POOLHASHRATES as $hour=>$hashrate}
<th scope="col">{$hour|default:"0"}:00</th>
{/foreach}
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Pool</th>
{foreach $POOLHASHRATES as $hour=>$hashrate}
<td>{$hashrate|default:"0"}</td>
{/foreach}
</tr>
</tbody>
</table>
<div class="tab-pane fade in" id="pool">
<div class="panel-heading">
Pool Hashrate
</div>
<div class="panel-body">
<div id="pool-area-chart"></div>
</div>
</div>
{/if}