diff --git a/projects/project-3/frontend/src/app/dashboard/dashboard.component.html b/projects/project-3/frontend/src/app/dashboard/dashboard.component.html index 736ad2a..acb397a 100644 --- a/projects/project-3/frontend/src/app/dashboard/dashboard.component.html +++ b/projects/project-3/frontend/src/app/dashboard/dashboard.component.html @@ -18,16 +18,33 @@
-
+
-
+
{{bikePoint?.commonName}}
-

{{bikePoint?.status.NbBikes}}

+
+
+ +
+
@@ -65,8 +82,6 @@
- -
@@ -76,7 +91,7 @@ station of lend destination {{element.endStationName}} + [routerLink]="['/dashboard/', element.id]">{{element.endStationName}} @@ -98,7 +113,7 @@ station of lend origin {{element.startStationName}} + [routerLink]="['/dashboard/', element.id]"> {{element.startStationName}} diff --git a/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts b/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts index a7e698d..a1faa14 100644 --- a/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts +++ b/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts @@ -51,6 +51,7 @@ export class DashboardComponent implements OnInit { @ViewChild('Station-Dashboard-Borrow-Duration') chart: ChartComponent; public durationChartOptions: Partial; public timeChartOptions: Partial; + public bikePointChartOptions: Partial; displayedColumnsTo: string[] = ['endStationName', 'number', 'avgDuration']; displayedColumnsFrom: string[] = ['startStationName', 'number', 'avgDuration']; stationToSource = new MatTableDataSource(); @@ -90,6 +91,15 @@ export class DashboardComponent implements OnInit { text: 'Loading...' } }; + this.bikePointChartOptions = { + series: [], + chart: { + type: 'bar' + }, + noData: { + text: 'Loading...' + } + }; } ngOnInit(): void { @@ -109,6 +119,83 @@ export class DashboardComponent implements OnInit { this.service.fetchBikePointForStatus(this.route.snapshot.paramMap.get('id')).then(data => { this.bikePoint = data; + const NbBlockedDocks = data.status.NbDocks - data.status.NbBikes - data.status.NbEmptyDocks; + this.bikePointChartOptions = { + series: [ + { + name: 'Bikes', + data: [data.status.NbBikes] + }, + { + name: 'Empty docks', + data: [data.status.NbEmptyDocks] + }, + { + name: 'Blocked docks', + data: [NbBlockedDocks] + } + ], + colors: ['#51ca49', '#8f8e8e', '#f00'], + chart: { + type: 'bar', + height: 180, + stacked: true, + toolbar: { + show: false + } + }, + plotOptions: { + bar: { + horizontal: true, + dataLabels: { + position: 'center' + } + } + }, + dataLabels: { + enabled: true, + style: { + fontSize: '20px', + colors: ['#fff'] + } + }, + stroke: { + show: false + }, + xaxis: { + labels: { + show: false + }, + axisBorder: { + show: false + }, + axisTicks: { + show: false + } + }, + yaxis: { + show: false, + title: { + text: undefined + }, + axisBorder: { + show: false + }, + min: 0, + max: data.status.NbDocks + }, + tooltip: { + enabled: false, + }, + fill: { + opacity: 1 + }, + legend: { + position: 'bottom', + horizontalAlign: 'right', + fontSize: '14px' + } + }; }); }