DX stats table #99

This commit is contained in:
Ian Renton
2026-03-29 10:57:34 +01:00
parent 4fe8dfc36a
commit 6f0101a861
10 changed files with 24 additions and 35 deletions

View File

@@ -108,18 +108,6 @@ function loadSolarConditions() {
});
}
// Take a normalised number 0-1 and generate a background colour for the DX stats cells
function dxStatsColor(t) {
const yellow = [255, 243, 205];
const green = [209, 231, 221];
if (t == 0.0) {
return "rgb(248, 215, 218)";
} else {
const ch = (i) => Math.round(yellow[i] + (green[i] - yellow[i]) * t);
return `rgb(${ch(0)}, ${ch(1)}, ${ch(2)})`;
}
}
// Render the DX stats table for the currently selected DE continent
function renderDxStats() {
if (!dxStatsData) { return; }
@@ -142,7 +130,8 @@ function renderDxStats() {
const range = max - min;
cells.forEach(function({ cell, count }) {
const t = range > 0 ? (count - min) / range : 0;
cell.css('background-color', dxStatsColor(t));
const cls = t === 0 ? 'table-danger' : t < 0.05 ? 'table-warning' : 'table-success';
cell.removeClass('table-danger table-warning table-success').addClass(cls);
});
}