@sailingrotevista/rotevista-dash 7.0.23 → 7.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +2 -5
- package/charts.js +13 -3
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -976,12 +976,9 @@ async function fetchServerHistory() {
|
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
-
// Sincronizza i dati specifici del radar storici
|
|
979
|
+
// Sincronizza i dati specifici del radar storici mantendo i timestamp calendarizzati assoluti (0% sfasamento dei perni)
|
|
980
980
|
if (data.windRadarSlots) {
|
|
981
|
-
store.windRadarSlots = data.windRadarSlots
|
|
982
|
-
...s,
|
|
983
|
-
timestamp: s.timestamp + timeDelta
|
|
984
|
-
}));
|
|
981
|
+
store.windRadarSlots = data.windRadarSlots; // Mantiene gli orari spaccati al minuto per l'uguaglianza del radar
|
|
985
982
|
}
|
|
986
983
|
if (data.futureForecast) {
|
|
987
984
|
store.futureForecast = {
|
package/charts.js
CHANGED
|
@@ -163,15 +163,25 @@ function refreshGraph(t) {
|
|
|
163
163
|
|
|
164
164
|
if (!rawData || rawData.length < 2) return;
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
// ALINEAMENTO STRUTTURALE: Filtriamo lo storico mantenendo solo la finestra temporale visibile
|
|
167
|
+
// prima di calcolare la scala, allineando millimetricamente la scala Y con i pixel disegnati a schermo.
|
|
168
|
+
const now = Date.now();
|
|
169
|
+
const visibleMinutes = CONFIG.graphs.historyMinutes * (isNavigating ? 1 : 2);
|
|
170
|
+
const viewportMs = visibleMinutes * 60000;
|
|
171
|
+
const viewportStart = now - viewportMs;
|
|
172
|
+
|
|
173
|
+
const visibleData = rawData.filter(p => p.time >= viewportStart);
|
|
174
|
+
if (visibleData.length < 2) return; // Abortisce se non ci sono abbastanza punti visibili
|
|
175
|
+
|
|
176
|
+
const values = visibleData.map(p => p.val); // Estrae i valori solo dei punti visibili
|
|
167
177
|
const mode = graphModes[boxType];
|
|
168
|
-
const cfg = calculateScale(boxType, values, mode);
|
|
178
|
+
const cfg = calculateScale(boxType, values, mode); // Calcola la scala Y esatta per la viewBox corrente
|
|
169
179
|
|
|
170
180
|
const box = document.querySelector(`.box-${boxType}`);
|
|
171
181
|
if (box) box.classList.toggle('box-hercules', mode === 'hercules');
|
|
172
182
|
|
|
173
183
|
updateScaleLabels(boxType, cfg.min, cfg.max);
|
|
174
|
-
drawGraph(
|
|
184
|
+
drawGraph(visibleData, boxType + '-graph', cfg.min, cfg.max, t === 'tws', mode === 'hercules');
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
// Genera fisicamente le curve e le aree SVG
|