From 210061442f5e584356059bcec22dcdde96a4f200 Mon Sep 17 00:00:00 2001 From: tim-herbst Date: Sun, 3 Jan 2021 14:20:39 +0100 Subject: [PATCH] fix error with color for polyline after change of date-span --- .../src/app/dashboard/table/table.component.ts | 14 ++++++++++---- .../frontend/src/app/service/map.service.ts | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/project-3/frontend/src/app/dashboard/table/table.component.ts b/projects/project-3/frontend/src/app/dashboard/table/table.component.ts index 597761f..dc1bc2f 100644 --- a/projects/project-3/frontend/src/app/dashboard/table/table.component.ts +++ b/projects/project-3/frontend/src/app/dashboard/table/table.component.ts @@ -79,13 +79,19 @@ export class TableComponent implements OnInit { await this.service.fetchDashboardStationTo(this.bikePoint.id, actualStartDate, actualEndDate).then((source) => { this.colors = ['black', 'gray', 'green', 'orange', 'purple', 'red']; this.isLoadingToSource = false; - this.stationToSource = source; - this.iterableToSource = this.setBikePointColorToSource(source); + this.stationToSource = this.setBikePointColorFromSource(source); + this.iterableToSource = source; + this.iterableToSource.forEach(bikePoint => { + bikePoint.polyLineColor = 'green'; + }); }); this.service.fetchDashboardStationFrom(this.bikePoint.id, actualStartDate, actualEndDate).then((source) => { this.isLoadingFromSource = false; - this.stationFromSource = source; - this.iterableFromSource = this.setBikePointColorFromSource(source); + this.stationFromSource = this.setBikePointColorFromSource(source); + this.iterableFromSource = source; + this.iterableFromSource.forEach(bikePoint => { + bikePoint.polyLineColor = 'red'; + }); }); } diff --git a/projects/project-3/frontend/src/app/service/map.service.ts b/projects/project-3/frontend/src/app/service/map.service.ts index 15c5cbc..aad157d 100644 --- a/projects/project-3/frontend/src/app/service/map.service.ts +++ b/projects/project-3/frontend/src/app/service/map.service.ts @@ -161,7 +161,7 @@ export class MapService { } drawLegend(): void { - this.legend.onAdd = map => { + this.legend.onAdd = () => { const div = L.DomUtil.create('div', 'legend'); div.innerHTML += `

trips from/to bike station

`; div.innerHTML += `rents with ${this.dashBoardBikePoint.commonName} as destination
`;