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:
+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