Fix hashrate chart: auto-scale tooltip units, remove green block lines
- layout.pug: formatNetworkChartValue now calls scaleFromGH() for Hashrate labels instead of appending the fixed (GH/s) unit, so tooltip values match the Y-axis auto-scaled unit (MH/s…PH/s) - custom.js: promote HASH_UNITS and scaleFromGH to global scope so layout.pug inline scripts can reuse them; fix unused 'mutations' param - settings.json.tmpl: disable block_line on both charts (was green rgba(0,128,0)); color updated to purple rgba(120,60,220,0.25)
This commit is contained in:
@@ -107,7 +107,7 @@
|
||||
"line_color": "rgba(54,162,235,1)",
|
||||
"fill_color": "rgba(54,162,235,0.2)",
|
||||
"crosshair_color": "#aaa",
|
||||
"block_line": { "enabled": true, "block_line_color": "rgba(0,128,0,0.2)" },
|
||||
"block_line": { "enabled": false, "block_line_color": "rgba(120,60,220,0.25)" },
|
||||
"round_decimals": 3,
|
||||
"chart_height": 320,
|
||||
"full_row": false,
|
||||
@@ -123,7 +123,7 @@
|
||||
"pos_line_color": "rgba(255,161,0,1)",
|
||||
"pos_fill_color": "rgba(255,161,0,0.2)",
|
||||
"crosshair_color": "#aaa",
|
||||
"block_line": { "enabled": true, "block_line_color": "rgba(0,128,0,0.2)" },
|
||||
"block_line": { "enabled": false, "block_line_color": "rgba(120,60,220,0.25)" },
|
||||
"round_decimals": 3,
|
||||
"chart_height": 320,
|
||||
"full_row": false,
|
||||
|
||||
+4
-4
@@ -1,7 +1,5 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// HASHRATE AUTO-SCALING
|
||||
// HASHRATE AUTO-SCALING (global scope — reused by layout.pug chart scripts)
|
||||
// The server sends hashrate already divided by nethash_units ("G"),
|
||||
// so values arrive in GH/s. We scale to keep the display 1–999.
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
@@ -26,6 +24,8 @@ $(document).ready(function() {
|
||||
return { num: gh, unit: 'GH/s' };
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// ── Panel: reformat #hashrate + update unit label ─────────────
|
||||
function refreshHashratePanel() {
|
||||
var $el = $('#hashrate');
|
||||
@@ -58,7 +58,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
// Start watching once #hashrate appears in the DOM
|
||||
var _panelWatcher = new MutationObserver(function(mutations, obs) {
|
||||
var _panelWatcher = new MutationObserver(function(_mutations, obs) {
|
||||
var el = document.getElementById('hashrate');
|
||||
if (el) {
|
||||
obs.disconnect();
|
||||
|
||||
+10
-4
@@ -540,6 +540,15 @@ html(lang='en')
|
||||
return Math.floor(timestamp * 1000 / (60 * 1000)) * (60 * 1000);
|
||||
}
|
||||
function formatNetworkChartValue(val, roundDecimals, lbl, returnNum) {
|
||||
if (returnNum)
|
||||
return (val || 0);
|
||||
|
||||
if (lbl == 'Hashrate' && typeof scaleFromGH === 'function') {
|
||||
var s = scaleFromGH(val || 0);
|
||||
var dec = Math.abs(s.num) >= 100 ? 0 : Math.abs(s.num) >= 10 ? 1 : 2;
|
||||
return s.num.toFixed(dec) + ' ' + s.unit;
|
||||
}
|
||||
|
||||
let max = 20;
|
||||
|
||||
if (roundDecimals != -1)
|
||||
@@ -551,10 +560,7 @@ html(lang='en')
|
||||
max = decimalCount;
|
||||
}
|
||||
|
||||
if (returnNum)
|
||||
return (val || 0);
|
||||
else
|
||||
return Number((val || 0)).toLocaleString('en',{'minimumFractionDigits':0,'maximumFractionDigits':max,'useGrouping':true}) + (lbl == 'Hashrate' ? ' ' + getNetHashUnits() : '');
|
||||
return Number((val || 0)).toLocaleString('en',{'minimumFractionDigits':0,'maximumFractionDigits':max,'useGrouping':true});
|
||||
}
|
||||
function populateHourChartData(result) {
|
||||
const roundedDataMap = new Map();
|
||||
|
||||
Reference in New Issue
Block a user