@@ -17,7 +17,6 @@ import { distinctUntilChanged } from 'rxjs/operators';
17
17
18
18
import assign from 'lodash-es/assign' ;
19
19
import merge from 'lodash-es/merge' ;
20
- import pick from 'lodash-es/pick' ;
21
20
22
21
@Directive ( {
23
22
// eslint-disable-next-line @angular-eslint/directive-selector
@@ -28,11 +27,11 @@ export class BaseChartDirective<TType extends ChartType = ChartType,
28
27
TData = DefaultDataPoint < TType > ,
29
28
TLabel = unknown > implements OnDestroy , OnChanges {
30
29
31
- @Input ( ) public type ! : ChartConfiguration < TType , TData , TLabel > [ 'type' ] ;
30
+ @Input ( ) public type : ChartConfiguration < TType , TData , TLabel > [ 'type' ] = 'bar' as TType ;
32
31
@Input ( ) public legend ?: boolean ;
33
32
@Input ( ) public data : ChartConfiguration < TType , TData , TLabel > [ 'data' ] = { datasets : [ ] } ;
34
33
@Input ( ) public options ?: ChartConfiguration < TType , TData , TLabel > [ 'options' ] ;
35
- @Input ( ) public plugins ?: ChartConfiguration < TType , TData , TLabel > [ 'plugins' ] ;
34
+ @Input ( ) public plugins ?: ChartConfiguration < TType , TData , TLabel > [ 'plugins' ] = [ ] ;
36
35
37
36
@Input ( ) public labels ?: ChartConfiguration < TType , TData , TLabel > [ 'data' ] [ 'labels' ] ;
38
37
@Input ( ) public datasets ?: ChartConfiguration < TType , TData , TLabel > [ 'data' ] [ 'datasets' ] ;
@@ -65,7 +64,9 @@ export class BaseChartDirective<TType extends ChartType = ChartType,
65
64
const config = this . getChartConfiguration ( ) ;
66
65
67
66
if ( this . chart ) {
68
- assign ( this . chart . config , pick ( config , [ 'data' , 'options' , 'plugins' ] ) ) ;
67
+ assign ( this . chart . config . data , config . data ) ;
68
+ assign ( this . chart . config . plugins , config . plugins ) ;
69
+ assign ( this . chart . config . options , config . options ) ;
69
70
}
70
71
71
72
this . update ( ) ;
@@ -90,6 +91,7 @@ export class BaseChartDirective<TType extends ChartType = ChartType,
90
91
91
92
public update ( duration ?: any ) : void {
92
93
if ( this . chart ) {
94
+ console . log ( this . chart . config )
93
95
this . zone . runOutsideAngular ( ( ) => this . chart ?. update ( duration ) ) ;
94
96
}
95
97
}
0 commit comments