feat(web-app): add unknown case for type of measure
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user