mitai-jinkendo/frontend/src/pilot/pilotChartUtils.js
Lars c0cb995a7b
All checks were successful
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 23s
feat: Remove deprecated pilot widgets and layout management
- Deleted unused components: GoalsSnapshotWidget, ReferenceValuesSummaryWidget, WeightKpiWidget, and PilotVizAdminCard.
- Removed associated layout storage and widget registry logic to streamline the pilot visualization module.
- Updated PilotVizPage to integrate new components for improved user experience and functionality.
2026-04-07 11:07:33 +02:00

17 lines
484 B
JavaScript

import dayjs from 'dayjs'
/** Gleiche Logik wie History.jsx für rollierende Mittel */
export function rollingAvg(arr, key, window = 7) {
return arr.map((d, i) => {
const s = arr
.slice(Math.max(0, i - window + 1), i + 1)
.map((x) => x[key])
.filter((v) => v != null)
return s.length
? { ...d, [`${key}_avg`]: Math.round((s.reduce((a, b) => a + b, 0) / s.length) * 10) / 10 }
: d
})
}
export const fmtDate = (d) => dayjs(d).format('DD.MM')