From 008e802c1ee2bf7ed21db0639d566e28f7dcdfd4 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 10 Jul 2020 18:18:14 +0200 Subject: [PATCH] grafico di produzione.. --- .../dashboard/base-components/stats.ts | 52 +++++++++++++++++++ .../dashboard/base-components/stats.vue | 14 +++++ .../app_modules_thermo/dashboard/dashboard.ts | 4 +- .../dashboard/dashboard.vue | 12 ++++- 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.ts create mode 100644 Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.vue diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.ts new file mode 100644 index 00000000..361dedd7 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.ts @@ -0,0 +1,52 @@ +import Vue from "vue"; +import Component from "vue-class-component"; +import { Prop } from "vue-property-decorator"; + +@Component({}) +export default class stats extends Vue { + + @Prop() + value: { [id: number]: number }; + + get Values(): number[] { + var r: number[] = []; + if (this.value) + for (const i in this.value) { + r.push(this.value[i]) + } + return r; + + } + + + get min() { + return Math.min(...this.Values); + } + + get max() { + return Math.max(...this.Values); + } + + get delta() { + return this.max - this.min; + } + + @Prop({ default: 400 }) + width: number; + + @Prop({ default: 50 }) + height: number; + + get pathData() { + if (this.Values && this.Values.length) { + var d = [ + "M", 0, (this.Values[0] - this.min) * this.height / this.delta, + "S" + ] + d.push(...this.Values.slice(1).map((v, idx) => `${idx * (this.width / this.Values.length)} ${this.height - (v - this.min) * this.height / this.delta}`)) + d.push() + return d.join(" "); + } + return null; + } +} \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.vue new file mode 100644 index 00000000..3cfb8386 --- /dev/null +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/base-components/stats.vue @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts index 365ad22d..7512fed8 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.ts @@ -10,13 +10,15 @@ import ArchInterface from "../components/arch-interface/arch-interface.vue"; import gauge from "./base-components/gauge.vue"; import { prodService } from '@/services/prodService'; import moment from 'moment'; +import stats from "./base-components/stats.vue"; @Component({ components: { appRibbon: AppRibbon, archInterface: ArchInterface, alarmList, - gauge + gauge, + stats } }) export default class Dashboard extends Vue { diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.vue index 2bcef384..46a313a2 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/dashboard/dashboard.vue @@ -136,17 +136,25 @@
{{'dashboard-piece-hours' | localize('pezzi/ora')}} - {{panel.lastCadenza}} + {{panel.lastCadenza | round(1)}} --
{{'dashboard-time-cycle' | localize('tempo/ciclo')}} - {{panel.lastTCiclo}} + {{panel.lastTCiclo / 60 | round(0)}}'{{panel.lastTCiclo % 60}}'' --
+
+ \ No newline at end of file