Hide conditions page entries if data isn't available

This commit is contained in:
Ian Renton
2026-04-03 21:47:35 +01:00
parent 64afd4ed55
commit 76b0ec24b7
13 changed files with 55 additions and 42 deletions

View File

@@ -84,7 +84,7 @@ function loadSolarConditions() {
const kIndex = jsonData.k_index;
if (kIndex !== null && kIndex !== undefined) {
applySwClass('sw-geomag-vals', 'sw-geomag-desc',
kIndex < 5 ? 'bg-success-subtle' : kIndex < 7 ? 'bg-warning-subtle' : 'bg-danger-subtle');
kIndex < 5 ? 'bg-success-subtle' : kIndex < 6 ? 'bg-warning-subtle' : 'bg-danger-subtle');
}
const xRay = jsonData.x_ray;
@@ -142,7 +142,7 @@ function renderKIndexForecast(data) {
const withAlpha = hex => tinycolor(hex).setAlpha(0.8).toRgbString();
const colors = entries.map(e =>
e.kp < 4.5 ? withAlpha(style.getPropertyValue('--bs-success').trim())
: e.kp < 6.5 ? withAlpha(style.getPropertyValue('--bs-warning').trim())
: e.kp < 5.5 ? withAlpha(style.getPropertyValue('--bs-warning').trim())
: withAlpha(style.getPropertyValue('--bs-danger').trim())
);
const textColor = style.getPropertyValue('--bs-body-color').trim() || '#666';
@@ -225,6 +225,7 @@ function renderKIndexForecast(data) {
datasets: [{
data: entries.map(e => e.kp),
backgroundColor: colors,
hoverBackgroundColor: colors,
borderWidth: 0,
}]
},