diff --git a/web-app/src/Measures/Serie.ts b/web-app/src/Measures/Serie.ts index 9fa8c99..d5450a3 100644 --- a/web-app/src/Measures/Serie.ts +++ b/web-app/src/Measures/Serie.ts @@ -22,8 +22,14 @@ export class Serie { this._device = device; } - public getLabel(): string { - return `${this._type} - ${this._user} - ${this._room} - ${this._device}`; + public getLabel(): String { + if (this._type === TEMPERATURE) { + return "Temperature [°C]"; + } else if (this._type === HUMIDITY) { + return "Humidity [%]"; + } else { + return "Unknown"; + } } public getSerie(): any { @@ -47,6 +53,16 @@ export class Serie { backgroundColor: "rgba(54, 162, 235, 0.2)", borderWidth: 1, }; + } else { + return { + label: "Unknown", + data: this._data.map((v: any) => { + return { x: v.time, y: v.value }; + }), + borderColor: "rgba(255, 206, 86, 1)", + backgroundColor: "rgba(255, 206, 86, 0.2)", + borderWidth: 1, + }; } } } diff --git a/web-app/src/components/ChartComponent.vue b/web-app/src/components/ChartComponent.vue index ae00c55..094870c 100644 --- a/web-app/src/components/ChartComponent.vue +++ b/web-app/src/components/ChartComponent.vue @@ -48,10 +48,7 @@ export default defineComponent({ }, setup(props) { const chartData = computed(() => { - if ( - props.manager || - ((props.manager as TimeSeriesManager).series.value as Serie[]) - ) { + if ((props.manager as TimeSeriesManager).series.value as Serie[]) { let series_prepared = (props.manager.series.value as Serie[]).map( (s: Serie) => { return s.getSerie();