diff --git a/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.html b/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.html index 3b20d5a..2e0da50 100644 --- a/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.html +++ b/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.html @@ -1,12 +1,30 @@ -{{station.commonName}}
-{{station.status.NbBikes}}
-{{station.status.NbDocks}}
-
- -
- + + + + {{station?.commonName}} + + + +
+ +
+
+ +
+
+ + +
diff --git a/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.scss b/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.scss index 583b745..e1f3364 100644 --- a/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.scss +++ b/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.scss @@ -3,9 +3,12 @@ padding: 0; } -#chart { - padding: 0; - max-width: 400px; - max-height: 400px; - margin: 35px auto; +.mat-card { + width: 30em; +} + +#route-button { + padding: 0 10px; + background-color: #017bfe; + color: white; } diff --git a/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.ts b/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.ts index 81e2469..1c65de9 100644 --- a/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.ts +++ b/projects/project-3/frontend/src/app/map/pop-up/pop-up.component.ts @@ -1,14 +1,33 @@ import {Component, OnInit} from '@angular/core'; import {IMapBikePoint} from '../../service/domain/map-bike-point'; import {Router} from '@angular/router'; - -import {ApexChart, ApexNonAxisChartSeries, ApexPlotOptions} from 'ng-apexcharts'; +import { + ApexAxisChartSeries, + ApexChart, + ApexDataLabels, + ApexFill, + ApexLegend, + ApexPlotOptions, + ApexStroke, + ApexTitleSubtitle, + ApexTooltip, + ApexXAxis, + ApexYAxis +} from 'ng-apexcharts'; export type ChartOptions = { - series: ApexNonAxisChartSeries; + series: ApexAxisChartSeries; chart: ApexChart; - labels: string[]; + colors: string[]; + dataLabels: ApexDataLabels; plotOptions: ApexPlotOptions; + xaxis: ApexXAxis; + yaxis: ApexYAxis; + stroke: ApexStroke; + title: ApexTitleSubtitle; + tooltip: ApexTooltip; + fill: ApexFill; + legend: ApexLegend; }; @@ -25,15 +44,71 @@ export class PopUpComponent implements OnInit { } ngOnInit(): void { - const bikes = Math.round((this.station.status.NbBikes / this.station.status.NbDocks) * 100); + const NbBlockedDocks = this.station.status.NbDocks - this.station.status.NbBikes - this.station.status.NbEmptyDocks; this.chartOptions = { - series: [bikes], + series: [ + { + name: 'Bikes', + data: [this.station.status.NbBikes] + }, + { + name: 'Empty docks', + data: [this.station.status.NbEmptyDocks] + }, + { + name: 'Blocked docks', + data: [NbBlockedDocks] + } + ], + colors: ['#51ca49', '#8f8e8e', '#f00'], chart: { - height: 300, - width: 300, - type: 'radialBar' + type: 'bar', + height: 125, + stacked: true, + toolbar: { + show: false + } }, - labels: ['Availability'] + plotOptions: { + bar: { + horizontal: true + } + }, + 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: this.station.status.NbDocks + }, + tooltip: { + enabled: false, + }, + fill: { + opacity: 1 + }, + legend: { + position: 'bottom', + horizontalAlign: 'right' + } }; }