-
-
35% - Remaining
-
-
-
-
-
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 0e6a1f6..39f9c71 100644
--- a/src/app/content/hemat-app/monitoring/building/building.component.ts
+++ b/src/app/content/hemat-app/monitoring/building/building.component.ts
@@ -7,12 +7,12 @@ import { TableMonitoringService } from "../monitoring.service";
styleUrls: ["./building.component.css"],
})
export class BuildingComponent {
- Data: any;
+ data: any;
public breadcrumb: any;
feedbacksdonutChart: any;
donutChart1: any;
filteredRows: any[];
- data: any[];
+ dataTop: any[];
searchTerm: string = "";
colorChart: string = "";
@@ -32,12 +32,9 @@ export class BuildingComponent {
this.donutChart1 = {
type: "Pie",
options: {
- donut: {
- colors: ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff']
- },
fullwidth: true,
height: "250px",
-
+ donut: true,
donutWidth: 60,
startAngle: 270,
total: 200,
@@ -48,18 +45,14 @@ export class BuildingComponent {
}
fetchData() {
- this.monitoringService.getMonitoringBuildingData().subscribe((Response) => {
- this.data = Response
- this.filteredRows = Response
- for (let i = 0; i < this.filteredRows.length; i++) {
- if (this.filteredRows[i].donut.series[0] <= 50) {
- this.colorChart = "donut-chart1"
- } else if (this.filteredRows[i].donut.series[0] > 50 && this.filteredRows[i].donut.series[0] < 75) {
- this.colorChart = "donut-chart2"
- } else {
- this.colorChart = "donut-chart3"
- }
- }
+ this.monitoringService.getMonitoringBuildingData().subscribe((res) => {
+ this.data = res
+ this.filteredRows = res
+ this.dataTop = res.map(item => ({
+ label: item.topUse.label,
+ value: item.topUse.value
+ }));
+
});
}
diff --git a/src/assets/data/hemat/building.json b/src/assets/data/hemat/building.json
index 9848237..4324dc4 100644
--- a/src/assets/data/hemat/building.json
+++ b/src/assets/data/hemat/building.json
@@ -2,7 +2,11 @@
{
"id": 1,
"build_name": "PT Allbest Solusi Sistem",
- "total": "2345",
+ "total": "342",
+ "topUse": {
+ "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"],
+ "value": [20, 40, 10, 30]
+ },
"donut": {
"series": [20, 80],
"labels": []
@@ -11,7 +15,11 @@
{
"id": 2,
"build_name": "PT Informa Media Pratama",
- "total": "342",
+ "total": "670",
+ "topUse": {
+ "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"],
+ "value": [20, 40, 10, 30]
+ },
"donut": {
"series": [40, 60],
"labels": []
@@ -20,16 +28,24 @@
{
"id": 3,
"build_name": "PT Ikea",
- "total": "342",
+ "total": "1480",
+ "topUse": {
+ "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"],
+ "value": [20, 40, 10, 30]
+ },
"donut": {
- "series": [50, 50],
+ "series": [70, 30],
"labels": []
}
},
{
"id": 4,
"build_name": "PT Tokopedia",
- "total": "342",
+ "total": "2050",
+ "topUse": {
+ "label": ["Lightning", "Air Conditioner", "Security System", "Elevator"],
+ "value": [20, 40, 10, 30]
+ },
"donut": {
"series": [90, 10],
"labels": []