@@ -47,8 +47,10 @@ export class LineChartsComponent implements OnInit {
4747 pointHoverBorderColor : 'rgba(44,129,192,1)' ,
4848 }
4949 } ,
50- legend : {
51- display : false
50+ plugins : {
51+ legend : {
52+ display : false
53+ }
5254 } ,
5355 maintainAspectRatio : false ,
5456 responsive : true ,
@@ -102,13 +104,13 @@ export class LineChartsComponent implements OnInit {
102104 const array = this . TopAgenciesChart . topAgencies [ this . selectedGovernment ] ;
103105
104106 if ( this . selectedPeriod === 'This Year' || this . selectedPeriod === 'All' ) {
105- const percentage : any [ ] = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
106- const pass : any [ ] = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
107- const total : any [ ] = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
107+ let percentage : any [ ] = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
108+ let pass : any [ ] = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
109+ let total : any [ ] = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
108110 for ( const item of this . TopAgenciesChart . topAgencies [ this . selectedGovernment ] )
109111 {
110112 if ( item . date != null ) {
111- const date = + item . date . split ( '/ ' ) [ 0 ] ;
113+ const date = + item . date . split ( '- ' ) [ 1 ] ;
112114 if ( item . predictions . value === 'green' ) {
113115 pass [ date - 1 ] ++ ;
114116 }
@@ -134,12 +136,13 @@ export class LineChartsComponent implements OnInit {
134136 } ;
135137 this . xAxis = 'Month' ;
136138 this . forceChartRefresh ( ) ;
137- } else if ( this . selectedPeriod === 'This Month' ) {
139+ }
140+ else if ( this . selectedPeriod === 'This Month' ) {
138141 const indexFrom = 1 ;
139142 const indexTo = this . toPeriod . getDate ( ) + 1 ;
140- const percentage : any [ ] = [ ] ;
141- const pass : any [ ] = [ ] ;
142- const total : any [ ] = [ ] ;
143+ let percentage : any [ ] = [ ] ;
144+ let pass : any [ ] = [ ] ;
145+ let total : any [ ] = [ ] ;
143146 this . lineChartLabels = [ ] ;
144147 const month = new Date ( ) . getMonth ( ) + 1 ;
145148 for ( let i = 1 ; i < indexTo ; i ++ ) {
@@ -148,11 +151,10 @@ export class LineChartsComponent implements OnInit {
148151 pass . push ( 0 ) ;
149152 total . push ( 0 ) ;
150153 }
151-
152154 for ( const item of this . TopAgenciesChart . topAgencies [ this . selectedGovernment ] )
153155 {
154- if ( item . date != null ) {
155- const date = + item . date . split ( '/ ' ) [ 1 ] ;
156+ if ( item . date != null && + item . date . split ( '-' ) [ 1 ] === month ) {
157+ const date = + item . date . split ( 'T ' ) [ 0 ] . split ( '-' ) [ 2 ] ;
156158 if ( item . predictions . value === 'green' ) {
157159 pass [ date - 1 ] ++ ;
158160 }
0 commit comments