Feature update and Improvement to Dashboard
* [FEATURE] Dasboard honors Ajax interval for hashrate graph * [IMPROVEMENT] Load graph plugins on graph template not on master template
This commit is contained in:
parent
8c96e166b7
commit
728ee2dd11
@ -31,10 +31,13 @@ if ( ! $user->isAdmin($user_id) && ($_REQUEST['id'] != $user_id && !empty($_REQU
|
||||
$username = $user->getUserName($id);
|
||||
}
|
||||
|
||||
// Fetch some settings
|
||||
if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300;
|
||||
|
||||
// Gather un-cached data
|
||||
$statistics->setGetCache(false);
|
||||
$start = microtime(true);
|
||||
$hashrate = $statistics->getUserHashrate($id, 300);
|
||||
$hashrate = $statistics->getUserHashrate($id, $interval);
|
||||
$end = microtime(true);
|
||||
$runtime = ($end - $start)* 1000;
|
||||
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.json2.min.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.dateAxisRenderer.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.highlighter.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.canvasTextRenderer.min.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
|
||||
|
||||
<article class="module width_full">
|
||||
<header><h3>Graphs</h3></header>
|
||||
<div class="module_content">
|
||||
<div id="hashrategraph" style="height:250px;width:100%; "></div>
|
||||
<div id="hashrategraph" style="height:200px; width: 95%;"></div>
|
||||
</div>
|
||||
<footer>
|
||||
<p style="margin-left: 25px">Refresh interval: {$GLOBAL.config.statistics_ajax_refresh_interval|default:"10"} seconds. Hashrate based on shares submitted in the past {$INTERVAL|default:"5"} minutes.</p>
|
||||
</footer>
|
||||
</article>
|
||||
|
||||
<script>{literal}
|
||||
@ -13,24 +22,36 @@ $(document).ready(function(){
|
||||
highlighter: { tooltipAxes: 'both', show: true },
|
||||
title: 'Hashrate',
|
||||
axes: {
|
||||
yaxis:{ min:0, pad: 0, padMax: 1.1},
|
||||
xaxis:{ min:0, max: 59, tickInterval: 5, pad: 0},
|
||||
yaxis:{ min:0, padMin: 0, padMax: 1.5, label: '{/literal}{$GLOBAL.hashunits.personal}{literal}', labelRenderer: $.jqplot.CanvasAxisLabelRenderer},
|
||||
xaxis:{ min:0, max: 60, tickInterval: 10, padMax: 0, label: 'Minutes', labelRenderer: $.jqplot.CanvasAxisLabelRenderer}
|
||||
},
|
||||
};
|
||||
for (var i = 0; i < 59; i++) { storedData[i] = [i, 0] }
|
||||
// Init empty graph with 0 data
|
||||
for (var i = 0; i < 60; i++) { storedData[i] = [i, 0] }
|
||||
$.jqplot('hashrategraph', [storedData], options);
|
||||
|
||||
// Fetch current datapoint as initial data
|
||||
var d = new Date();
|
||||
storedData[d.getMinutes()] = [ d.getMinutes(), {/literal}{$GLOBAL.userdata.hashrate}{literal} ];
|
||||
$.jqplot('hashrategraph', [storedData], options);
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
storedData[d.getMinutes()] = [d.getMinutes(), data.getuserhashrate.hashrate];
|
||||
$.jqplot('hashrategraph', [storedData], options).replot();
|
||||
}
|
||||
});
|
||||
|
||||
// Update graph
|
||||
setInterval(function() {
|
||||
var d = new Date();
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var d = new Date();
|
||||
storedData[d.getMinutes()] = [d.getMinutes(), data.getuserhashrate.hashrate];
|
||||
$.jqplot('hashrategraph', [storedData], options).replot();
|
||||
}
|
||||
});
|
||||
}, 25000);
|
||||
}, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal});
|
||||
});
|
||||
{/literal}</script>
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
<!--[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" />
|
||||
<!--[if lt IE 9]>
|
||||
<link rel="stylesheet" href="{$PATH}/css/ie.css" type="text/css" media="screen" />
|
||||
<link rel="stylesheet" href="{$PATH}/css/jquery.jqplot.min.css" type="text/css" media="screen" />
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery-2.0.3.min.js" type="text/javascript"></script>
|
||||
@ -20,9 +20,6 @@
|
||||
<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/plugins/jqplot.json2.min.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.dateAxisRenderer.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/plugins/jqplot.highlighter.js"></script>
|
||||
<script type="text/javascript" src="{$PATH}/js/jquery.tooltip.visualize.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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user