Skip to content

Commit

Permalink
fixed data showing in incorrect order in dashboard graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussefDahi committed Dec 20, 2024
1 parent 31814b1 commit 904ac3e
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/app/views/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AfterViewInit, Component, inject, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, Component, inject, ViewChild } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { combineLatest, finalize, forkJoin, map, Observable, Subscription, take } from 'rxjs';
import { DatePipe, Location } from '@angular/common';
Expand Down Expand Up @@ -120,7 +120,7 @@ export class DashboardComponent implements AfterViewInit {
this.setChartDialogEvent()

Object.keys(this.chartRequests).forEach(k => {
if(this.chartRequests[k].isLoading!= true){
if(!this.chartRequests[k].isLoading){
this.charts[k] = [];
this.chartRequests[k].isLoading = true;
this.chartRequests[k].observable
Expand All @@ -136,16 +136,13 @@ export class DashboardComponent implements AfterViewInit {
})
}

init() {

}

initTab() {
let that: any = this;
let serverParam = this.createServerFilter();

Object.keys(this.tabRequests).forEach(i => {
if(this.tabRequests[i].isLoading!= true){
if(!this.tabRequests[i].isLoading){
this.tabRequests[i].isLoading = true;
this.tabRequests[i].observable
.pipe(finalize(() => { this.tabRequests[i].isLoading = false; })).pipe(take(1))
Expand Down Expand Up @@ -207,9 +204,6 @@ export class DashboardComponent implements AfterViewInit {
this.constants.FTP_REQUEST_EXCEPTION_BY_PERIOD_LINE,
this.constants.SMTP_REQUEST_EXCEPTION_BY_PERIOD_LINE,
this.constants.LDAP_REQUEST_EXCEPTION_BY_PERIOD_LINE].forEach((p: ChartProvider<string, number> | ChartProvider<Date, number>) => {
// p = Object.assign({}, p);
// p.options.title.text = `${p.options.chart.data.type}: `;
// p.options.subtitle.Text = '';
p.options.chart.toolbar = {
show: true,
tools: {
Expand Down Expand Up @@ -254,7 +248,7 @@ export class DashboardComponent implements AfterViewInit {
let subtitle = ''
formatters[groupedBy](data, this._datePipe)

let arr = this.groupByProperty("date", data).map((d: any) => { return { ...d, perc: (d.count * 100) / d.countok } });
let arr = this.groupByProperty("date", data).map((d: any) => { return { ...d, perc: (d.count * 100) / d.countok } }).sort((a,b)=> a.date.localeCompare(b.date));
if (arr.length) {
let sumRes = this.sumcounts(arr);
title = `${type}: ${((sumRes.count * 100) / sumRes.countok).toFixed(2)}%`;
Expand Down

0 comments on commit 904ac3e

Please sign in to comment.