From b6dd2ee8252eb6c0ebc42c910e63bd461250a0a7 Mon Sep 17 00:00:00 2001 From: Tim Herbst Date: Tue, 22 Dec 2020 23:07:28 +0100 Subject: [PATCH] change series and categories matching due to lexicographic sort of minutesGroup --- .../src/app/dashboard/dashboard.component.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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 2bb46e7..2815884 100644 --- a/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts +++ b/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts @@ -112,12 +112,11 @@ export class DashboardComponent implements OnInit { numbers.push(value.number); minutesGroup.push(value.minutesGroup); }); - this.durationChartOptions = { series: [ { name: 'borrow-duration', - data: [...numbers] + data: [numbers[0], numbers[4], numbers[1], numbers[2], numbers[3]] } ], chart: { @@ -140,7 +139,7 @@ export class DashboardComponent implements OnInit { colors: ['transparent'] }, xaxis: { - categories: [...minutesGroup] + categories: [minutesGroup[0], minutesGroup[4], minutesGroup[1], minutesGroup[2], minutesGroup[3]] }, yaxis: { title: { @@ -163,23 +162,22 @@ export class DashboardComponent implements OnInit { this.stationToSource = source; this.changeDetectorRefs.detectChanges(); }); - this.service.fetch_dashboard_station_from(this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualStartDate.toISOString().substring(0, 10)).then((source) => { + this.service.fetch_dashboard_station_from(this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualEndDate.toISOString().substring(0, 10)).then((source) => { this.stationFromSource = source; this.changeDetectorRefs.detectChanges(); }); - this.service.fetch_dashboard_station_duration(this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualStartDate.toISOString().substring(0, 10)).then((source) => { + this.service.fetch_dashboard_station_duration(this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualEndDate.toISOString().substring(0, 10)).then((source) => { const numbers = []; const minutesGroup = []; source.forEach(value => { numbers.push(value.number); minutesGroup.push(value.minutesGroup); }); - this.durationChartOptions = { series: [ { name: 'borrow-duration', - data: [...numbers] + data: [numbers[0], numbers[4], numbers[1], numbers[2], numbers[3]] } ], chart: { @@ -202,7 +200,7 @@ export class DashboardComponent implements OnInit { colors: ['transparent'] }, xaxis: { - categories: [...minutesGroup] + categories: [minutesGroup[0], minutesGroup[4], minutesGroup[1], minutesGroup[2], minutesGroup[3]] }, yaxis: { title: {