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