change series and categories matching due to lexicographic sort of minutesGroup

This commit is contained in:
Tim Herbst 2020-12-22 23:07:28 +01:00
parent 678272ef8a
commit b6dd2ee825

View File

@ -112,12 +112,11 @@ export class DashboardComponent implements OnInit {
numbers.push(value.number); numbers.push(value.number);
minutesGroup.push(value.minutesGroup); minutesGroup.push(value.minutesGroup);
}); });
this.durationChartOptions = { this.durationChartOptions = {
series: [ series: [
{ {
name: 'borrow-duration', name: 'borrow-duration',
data: [...numbers] data: [numbers[0], numbers[4], numbers[1], numbers[2], numbers[3]]
} }
], ],
chart: { chart: {
@ -140,7 +139,7 @@ export class DashboardComponent implements OnInit {
colors: ['transparent'] colors: ['transparent']
}, },
xaxis: { xaxis: {
categories: [...minutesGroup] categories: [minutesGroup[0], minutesGroup[4], minutesGroup[1], minutesGroup[2], minutesGroup[3]]
}, },
yaxis: { yaxis: {
title: { title: {
@ -163,23 +162,22 @@ export class DashboardComponent implements OnInit {
this.stationToSource = source; this.stationToSource = source;
this.changeDetectorRefs.detectChanges(); 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.stationFromSource = source;
this.changeDetectorRefs.detectChanges(); 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 numbers = [];
const minutesGroup = []; const minutesGroup = [];
source.forEach(value => { source.forEach(value => {
numbers.push(value.number); numbers.push(value.number);
minutesGroup.push(value.minutesGroup); minutesGroup.push(value.minutesGroup);
}); });
this.durationChartOptions = { this.durationChartOptions = {
series: [ series: [
{ {
name: 'borrow-duration', name: 'borrow-duration',
data: [...numbers] data: [numbers[0], numbers[4], numbers[1], numbers[2], numbers[3]]
} }
], ],
chart: { chart: {
@ -202,7 +200,7 @@ export class DashboardComponent implements OnInit {
colors: ['transparent'] colors: ['transparent']
}, },
xaxis: { xaxis: {
categories: [...minutesGroup] categories: [minutesGroup[0], minutesGroup[4], minutesGroup[1], minutesGroup[2], minutesGroup[3]]
}, },
yaxis: { yaxis: {
title: { title: {