menghilangkan water

This commit is contained in:
Fuzi_fauzia 2024-06-24 12:28:05 +07:00
parent 30726d44b4
commit 873e24a6ac
2 changed files with 38 additions and 40 deletions

View File

@ -97,8 +97,6 @@ export class ControlDeviceSeemoreComponent {
dataListBuilding() {
this.monitoringApiService.getBuildingList().subscribe((data) => {
this.dataBuildingList = data.data.filter((item) => item.statusId === 2);
console.log(this.dataBuildingList);
});
}

View File

@ -62,18 +62,18 @@ export class DetailComponent {
barPercentage: 0.5,
categoryPercentage: 0.5,
},
{
data: [],
label: "Water Consumption",
backgroundColor: "#64CFF1",
borderColor: "#64CFF1",
pointBackgroundColor: "#64CFF1",
pointBorderColor: "#64CFF1",
pointHoverBackgroundColor: "#ffffff",
pointHoverBorderColor: "#64CFF1",
barPercentage: 0.5,
categoryPercentage: 0.5,
},
// {
// data: [],
// label: "Water Consumption",
// backgroundColor: "#64CFF1",
// borderColor: "#64CFF1",
// pointBackgroundColor: "#64CFF1",
// pointBorderColor: "#64CFF1",
// pointHoverBackgroundColor: "#ffffff",
// pointHoverBorderColor: "#64CFF1",
// barPercentage: 0.5,
// categoryPercentage: 0.5,
// },
{
type: "line",
data: [],
@ -89,21 +89,21 @@ export class DetailComponent {
tension: 0.3,
spanGaps: true
},
{
type: "line",
data: [],
label: "Weekly Water Average",
backgroundColor: "rgba(0,255,255,0)",
borderColor: "#ffffff",
fill: false,
pointBorderColor: "#ffffff",
pointBackgroundColor: "#FFF",
pointBorderWidth: 2,
pointHoverBorderWidth: 2,
pointRadius: 4,
tension: 0.3,
spanGaps: true
},
// {
// type: "line",
// data: [],
// label: "Weekly Water Average",
// backgroundColor: "rgba(0,255,255,0)",
// borderColor: "#ffffff",
// fill: false,
// pointBorderColor: "#ffffff",
// pointBackgroundColor: "#FFF",
// pointBorderWidth: 2,
// pointHoverBorderWidth: 2,
// pointRadius: 4,
// tension: 0.3,
// spanGaps: true
// },
];
//..........................
@ -261,15 +261,15 @@ export class DetailComponent {
.subscribe((res) => {
this.chartKwhWater = res.data;
this.barChartData[0].data = [];
this.barChartData[1].data = [];
// this.barChartData[1].data = [];
this.chartKwhWater.forEach((entry) => {
this.barChartData[0].data.push(entry.kwh);
this.barChartData[1].data.push(entry.water);
// this.barChartData[1].data.push(entry.water);
this.barChartLabels.push(entry.day);
});
const weeklyKwh = this.aggregateKwhWeekly(this.chartKwhWater);
const weeklyWater = this.aggregateWaterWeekly(this.chartKwhWater);
// const weeklyWater = this.aggregateWaterWeekly(this.chartKwhWater);
// Populate Appointment data at every multiple of 7
let weekIndex = 0;
@ -281,14 +281,14 @@ export class DetailComponent {
}
}
let weekIndexWater = 0;
for (let i = 0; i < this.barChartData[0].data.length; i++) {
if (i % 7 === 6 && weekIndexWater < weeklyWater.length) {
this.barChartData[3].data[i] = weeklyWater[weekIndexWater++];
} else {
this.barChartData[3].data[i] = null;
}
}
// let weekIndexWater = 0;
// for (let i = 0; i < this.barChartData[0].data.length; i++) {
// if (i % 7 === 6 && weekIndexWater < weeklyWater.length) {
// this.barChartData[3].data[i] = weeklyWater[weekIndexWater++];
// } else {
// this.barChartData[3].data[i] = null;
// }
// }
});
}
aggregateKwhWeekly(data: any[]): number[] {