diff --git a/webapp/src/components/BarChart.vue b/webapp/src/components/BarChart.vue index 1435dcf9..230f6de0 100644 --- a/webapp/src/components/BarChart.vue +++ b/webapp/src/components/BarChart.vue @@ -15,18 +15,29 @@ import type { DatabaseStatus } from "@/types/DatabaseStatus"; import { GChart } from 'vue-google-charts'; //import { DatetimeFormat } from 'vue-i18n'; -var data: any; -export const type = 'ColumnChart'; -export const options = { +var data_col: any; +export const type_col = 'ColumnChart'; +export const options_col = { height: 300, - chartArea: { top: 25, width: '85%', height: '80%' }, + chartArea: { + top: 25, + width: '85%', + height: '80%' + }, + bar: { + groupWidth: '100%' + }, legend: { position: 'none' }, hAxis: { format: 'HH', + minorGridlines: { + count: 0 + } }, vAxis: { + minValue: 0, format: '# Wh' } }; @@ -40,9 +51,9 @@ export default defineComponent({ setup() { return () => h(GChart, { - data, - options, - type + data: data_col, + options: options_col, + type: type_col }); }, beforeMount() { @@ -60,11 +71,18 @@ export default defineComponent({ var old_energy = 0.0; start.setDate(end.getDate() - interval); start.setHours(start.getHours() - 2); - data = [['Time', 'Energy']]; + data_col = [[{ + type: 'date', + id: 'Time' + }, + { + type: 'number', + id: 'Energy' + }]] energy.forEach((x: any[]) => { var d = new Date(x[0] + 2000, x[1] - 1, x[2], x[3]); if ((d >= start) && (d <= end) && (old_energy > 0.0)) { - data.push([d, Math.round((x[4] - old_energy) * 1000)]) + data_col.push([d, Math.round((x[4] - old_energy) * 1000)]) } old_energy = x[4] }) diff --git a/webapp/src/components/CalendarChart.vue b/webapp/src/components/CalendarChart.vue index 52697fe4..794602ea 100644 --- a/webapp/src/components/CalendarChart.vue +++ b/webapp/src/components/CalendarChart.vue @@ -3,7 +3,9 @@
- +
+ +
@@ -13,15 +15,16 @@ import { defineComponent, type PropType, h } from 'vue'; import type { DatabaseStatus } from "@/types/DatabaseStatus"; import { GChart } from 'vue-google-charts'; -var data: any; -export const type = 'Calendar'; -export const options = { - height: 250, +var data_cal: any; +export const type_cal = 'Calendar'; +export const options_cal = { + height: 270, colorAxis: { - colors: ['#FFFFFF', '#0000FF'] - }, + minValue: 0, + colors: ['#FFFFFF', '#0000FF'] + }, calendar: { - cellSize: 20, + cellSize: 24, }, }; export default defineComponent({ @@ -34,9 +37,9 @@ export default defineComponent({ setup() { return () => h(GChart, { - data, - options, - type, + data: data_cal, + options: options_cal, + type: type_cal, settings: { packages: ['calendar'], } @@ -50,7 +53,7 @@ export default defineComponent({ }, methods: { drawChart() { - data = [[{ + data_cal = [[{ type: 'date', id: 'Date' }, @@ -70,7 +73,7 @@ export default defineComponent({ old_energy = x[4]; } else { if (x[2] != old_day) { - data.push(a) + data_cal.push(a) old_day = x[2] old_energy = last_energy } @@ -79,7 +82,7 @@ export default defineComponent({ d = new Date(x[0] + 2000, x[1] - 1, x[2], x[3]) a = [d, Math.round((last_energy - old_energy) * 1000)] }) - data.push(a) + data_cal.push(a) } } }); diff --git a/webapp_dist/js/app.js.gz b/webapp_dist/js/app.js.gz index 9b80843d..95040144 100644 Binary files a/webapp_dist/js/app.js.gz and b/webapp_dist/js/app.js.gz differ