feat(history): add electricity price chart

This commit is contained in:
2026-08-02 15:52:22 +02:00
parent f70f3ab054
commit 029c29afd1
10 changed files with 137 additions and 20 deletions
+14 -4
View File
@@ -1,7 +1,8 @@
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue';
import { computed, onMounted, ref, watch } from 'vue';
import useHistoryViewModel from '../viewmodels/HistoryViewModel';
import moment from 'moment';
import Chart from '../components/Chart.vue';
const model = useHistoryViewModel();
@@ -14,10 +15,19 @@ onMounted(() => {
watch(date, (value) => {
model.getHistoryData(moment(value).format('YYYY-MM-DD'));
});
const chartData = computed(
() =>
model.historyData.value?.electricity
.filter((e) => e.totalPriceTaxIncluded != null)
.map((e) => ({
label: moment(e.startDate).format('HH:mm'),
value: e.totalPriceTaxIncluded,
})) ?? [],
);
</script>
<template>
<div>
<input type="date" v-model="date" />
</div>
<input type="date" v-model="date" />
<Chart :data="chartData" />
</template>