changed chart options

This commit is contained in:
Ralf Bauer 2023-06-03 15:07:12 +02:00
parent 7824a0604e
commit 10397d1188
2 changed files with 6 additions and 18 deletions

View File

@ -62,7 +62,7 @@ export default defineComponent({
energy.forEach((x: any[]) => { energy.forEach((x: any[]) => {
var d = new Date(x[0] + 2000, x[1] - 1, x[2], x[3]); var d = new Date(x[0] + 2000, x[1] - 1, x[2], x[3]);
if ((d >= start) && (d <= end)) { if ((d >= start) && (d <= end)) {
data.push([d, (x[4] - old_energy) * 1000]) data.push([d, Math.round((x[4] - old_energy) * 1000)])
} }
old_energy = x[4] old_energy = x[4]
}) })

View File

@ -12,21 +12,14 @@
import { defineComponent, type PropType, h } from 'vue'; import { defineComponent, type PropType, h } from 'vue';
import type { DatabaseStatus } from "@/types/DatabaseStatus"; import type { DatabaseStatus } from "@/types/DatabaseStatus";
import { GChart } from 'vue-google-charts'; import { GChart } from 'vue-google-charts';
//import { DatetimeFormat } from 'vue-i18n';
var data: any; var data: any;
export const type = 'Calendar'; export const type = 'Calendar';
export const options = { export const options = {
legend: { calendar: {
position: 'none' cellSize: 22,
daysOfWeek: 'MTWTFSS',
}, },
hAxis: {
format: 'dd.MM.YY HH:mm',
slantedText: true
},
vAxis: {
format: '# Wh'
}
}; };
export default defineComponent({ export default defineComponent({
components: { components: {
@ -42,7 +35,7 @@ export default defineComponent({
options, options,
type, type,
settings: { settings: {
packages: ['calendar'] packages: ['calendar'],
} }
}); });
}, },
@ -78,14 +71,9 @@ export default defineComponent({
} }
last_energy = x[4] last_energy = x[4]
d = new Date(x[0] + 2000, x[1] - 1, x[2], x[3]) d = new Date(x[0] + 2000, x[1] - 1, x[2], x[3])
a = [d, ((last_energy - old_energy) * 1000).toFixed(0)] a = [d, Math.round((last_energy - old_energy) * 1000)]
}) })
data.push(a) data.push(a)
// var date_formatter = new google.visualization.DateFormat({
// pattern: "dd.MM.YY HH:mm"
// });
// date_formatter.format(data, 0);
} }
} }
}); });