Dash web: crosshair, zoom/pan X, scale log/lin, continuum extraction, background resume

- Tooltip entier (intersect:false) + ligne verticale crosshair sur tous les graphes
- Zoom molette/pinch sur l'axe X, pan souris, limites clamped 30-3000 keV
- Toggle échelle log/linéaire onglet Background
- Extraction continuum détecteur (isotope peaks subtracted + Gaussian smoothing)
- Reprise snapshot précédent au démarrage capture_background.py
- Suppression refs "Théorique" et "Bruit capteur" de l'interface
- Plugin chartjs-plugin-zoom + hammerjs via CDN
- Fix Chart constructor spread operator

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Jacquin Antoine
2026-05-19 23:26:28 +02:00
parent 0f2417bf88
commit c764a5c264
15 changed files with 975 additions and 221 deletions

View File

@ -28,9 +28,13 @@ async function refreshStatus() {
}
const data = await resp.json();
const dot = document.getElementById('status-connected');
dot.className = data.connected && !data.stale ? 'status-dot connected' : 'status-dot';
const ok = data.connected && !data.stale;
dot.className = ok ? 'status-dot connected' : 'status-dot';
document.getElementById('status-cps').textContent = `${data.cps.toFixed(1)} CPS`;
document.getElementById('status-live-time').textContent = `${data.cumulated_live_time_h.toFixed(1)} h`;
document.title = ok
? `${data.cps.toFixed(1)} CPS · ${data.cumulated_live_time_h.toFixed(1)}h`
: 'Hors ligne';
} catch {
document.getElementById('status-connected').className = 'status-dot';
}
@ -47,5 +51,41 @@ function startRefresh() {
}, REFRESH_MS);
}
// Initialize
startRefresh();
// Isotope lines toggle — show/hide "detected only" checkbox
document.getElementById('show-isotope-lines').addEventListener('change', (e) => {
document.getElementById('lines-detected-label').style.display = e.target.checked ? 'flex' : 'none';
if (!e.target.checked) refreshSpectrum();
});
// Fullscreen toggle for charts
function exitFullscreen() {
document.querySelectorAll('.chart-container.fullscreen').forEach(c => c.classList.remove('fullscreen'));
document.querySelectorAll('.fullscreen-btn, #fullscreen-btn').forEach(btn => btn.innerHTML = '&#x26F6;');
setTimeout(() => window.dispatchEvent(new Event('resize')), 100);
}
document.querySelectorAll('.fullscreen-btn, #fullscreen-btn').forEach(btn => {
btn.addEventListener('click', () => {
const container = btn.closest('section').querySelector('.chart-container');
if (container.classList.contains('fullscreen')) {
exitFullscreen();
} else {
container.classList.add('fullscreen');
btn.innerHTML = '&#x2715;';
setTimeout(() => window.dispatchEvent(new Event('resize')), 100);
}
});
});
// Exit fullscreen buttons inside chart containers
document.querySelectorAll('.exit-fullscreen-btn').forEach(btn => {
btn.addEventListener('click', exitFullscreen);
});
// ESC to exit fullscreen
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') exitFullscreen();
});
// Initialize — called after all scripts are loaded
window.addEventListener('load', startRefresh);