feat(web-app): add unknown case for type of measure

This commit is contained in:
fastium
2025-05-20 09:58:15 +02:00
parent 71f8883f16
commit 803f93041b
2 changed files with 19 additions and 6 deletions

View File

@@ -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,
};
}
}
}