diff --git a/src/app/content/hemat-app/monitoring/building/building.component.html b/src/app/content/hemat-app/monitoring/building/building.component.html index 7ff7feb..1c1ba8a 100644 --- a/src/app/content/hemat-app/monitoring/building/building.component.html +++ b/src/app/content/hemat-app/monitoring/building/building.component.html @@ -90,15 +90,17 @@ class="col-xl-6 col-md-6 col-12" *ngFor="let top of dataTop; let i = index" > - {{ top.value[i] }}% - {{ top.label[i] }}
- + {{ top.value[i] }}% - {{ top.label[i] }} +
+ +
diff --git a/src/app/content/hemat-app/monitoring/building/building.component.ts b/src/app/content/hemat-app/monitoring/building/building.component.ts index 39f9c71..7832b72 100644 --- a/src/app/content/hemat-app/monitoring/building/building.component.ts +++ b/src/app/content/hemat-app/monitoring/building/building.component.ts @@ -46,13 +46,18 @@ export class BuildingComponent { fetchData() { this.monitoringService.getMonitoringBuildingData().subscribe((res) => { - this.data = res - this.filteredRows = res - this.dataTop = res.map(item => ({ - label: item.topUse.label, - value: item.topUse.value - })); - + this.data = res; + this.filteredRows = res; + + this.dataTop = []; + for (let i = 0; i < res.length; i++) { + if (res[i].topUse.label[i]) { + this.dataTop.push({ + label: res[i].topUse.label, + value: res[i].topUse.value, + }); + } + } }); } @@ -73,5 +78,4 @@ export class BuildingComponent { value !== null && value.toString().toLowerCase().includes(searchTermLC) ); } - } diff --git a/src/assets/data/hemat/building.json b/src/assets/data/hemat/building.json index 4324dc4..dcd008b 100644 --- a/src/assets/data/hemat/building.json +++ b/src/assets/data/hemat/building.json @@ -50,5 +50,57 @@ "series": [90, 10], "labels": [] } + }, + { + "id": 5, + "build_name": "PT Allbest Solusi", + "total": "342", + "topUse": { + "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"], + "value": [20, 40, 10, 30] + }, + "donut": { + "series": [20, 80], + "labels": [] + } + }, + { + "id": 6, + "build_name": "PT Informa Media", + "total": "670", + "topUse": { + "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"], + "value": [20, 40, 10, 30] + }, + "donut": { + "series": [40, 60], + "labels": [] + } + }, + { + "id": 7, + "build_name": "PT Ikea Yes", + "total": "1480", + "topUse": { + "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"], + "value": [20, 40, 10, 30] + }, + "donut": { + "series": [70, 30], + "labels": [] + } + }, + { + "id": 8, + "build_name": "PT Gojek", + "total": "2050", + "topUse": { + "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"], + "value": [20, 40, 10, 30] + }, + "donut": { + "series": [90, 10], + "labels": [] + } } ] \ No newline at end of file