Barometer-Trend mit eingeführt

This commit is contained in:
2026-04-24 15:49:03 +02:00
parent 3652831bc3
commit 8961b9237c
3 changed files with 24 additions and 3 deletions

View File

@@ -139,6 +139,11 @@
margin: 0.2rem -0.5rem -0.5rem -0.5rem;
}
.bar-trend {
font-size: 0.9em;
cursor: help;
}
.dashboard-footer {
/* margin-top: 2rem;
*/ padding-top: 1rem;

View File

@@ -218,6 +218,21 @@ const WeatherDashboard = ({ data, currentData = [], rainData = [], timeRange = '
return { yMin: min, yMax: max }
}
// Hilfsfunktion: BarTrend-Wert (Davis VantagePro) → Pfeil + Label
// Werte laut Davis Serial Communication Reference Rev 2.6.1:
// -60 = Falling Rapidly, -20 = Falling Slowly, 0 = Steady,
// 20 = Rising Slowly, 60 = Rising Rapidly, 80/'P' = kein Trend
const barTrendArrow = (trend) => {
switch (trend) {
case -60: return { arrow: '⬇⬇', label: 'Fällt schnell' }
case -20: return { arrow: '⬇', label: 'Fällt langsam' }
case 0: return { arrow: '→', label: 'Stabil' }
case 20: return { arrow: '⬆', label: 'Steigt langsam' }
case 60: return { arrow: '⬆⬆', label: 'Steigt schnell' }
default: return null
}
}
// Gemeinsame Chart-Optionen (angepasst an Zeitraum)
const getCommonOptions = () => {
// Prüfe, ob es ein custom range ist
@@ -999,7 +1014,7 @@ const WeatherDashboard = ({ data, currentData = [], rainData = [], timeRange = '
<div className="chart-item">
<div className="current-value">Aktuell: {current.pressure?.toFixed(0) || '-'} hPa</div>
<div className="chart-container">
<h3><span>🌐 Luftdruck{aggregationSuffix}</span><span className="unit">[hPa]</span></h3>
<h3><span>🌐 Luftdruck{aggregationSuffix}{(() => { const t = barTrendArrow(current.bar_trend); return t ? <span className="bar-trend" title={t.label}> {t.arrow}</span> : null })()}</span><span className="unit">[hPa]</span></h3>
<div className="chart-wrapper">
<HighchartsReact highcharts={Highcharts} options={pressureOptions} />
</div>