@@ -18,17 +18,23 @@ import {
1818 Input ,
1919 OnChanges ,
2020 OnDestroy ,
21- OnInit ,
2221 SimpleChanges ,
2322 ViewChild ,
2423} from '@angular/core' ;
25- import { BaseType , ContainerElement , select , Selection } from 'd3-selection' ;
24+ import {
25+ trigger ,
26+ style ,
27+ animate ,
28+ transition ,
29+ group ,
30+ } from '@angular/animations' ;
31+ import { ContainerElement , select , Selection } from 'd3-selection' ;
2632import { Subject , Subscription } from 'rxjs' ;
2733import { ChartSlice , ChartSlices } from './model/chart-slices' ;
2834import { debounceTime } from 'rxjs/operators' ;
2935import 'd3-transition' ;
3036import { scaleOrdinal } from 'd3-scale' ;
31- import { interpolateSpectral , schemeSpectral } from 'd3-scale-chromatic' ;
37+ import { interpolateSpectral } from 'd3-scale-chromatic' ;
3238import { arc , pie } from 'd3-shape' ;
3339import { range } from 'd3-array' ;
3440
@@ -40,6 +46,17 @@ interface ResizeEvent {
4046 selector : 'sc-donut-chart' ,
4147 templateUrl : './sc-donut-chart.component.html' ,
4248 styleUrls : [ './sc-donut-chart.component.scss' ] ,
49+ animations : [
50+ trigger ( 'fadeInGrow' , [
51+ transition ( '* => ready' , [
52+ style ( { opacity : 0 , transform : 'scale(0.1)' } ) ,
53+ group ( [
54+ animate ( '300ms linear' , style ( { opacity : 1 } ) ) ,
55+ animate ( '1000ms linear' , style ( { transform : 'scale(1)' } ) ) ,
56+ ] ) ,
57+ ] ) ,
58+ ] ) ,
59+ ] ,
4360} )
4461export class ScDonutChartComponent
4562 implements OnChanges , OnDestroy , AfterViewInit
@@ -51,6 +68,8 @@ export class ScDonutChartComponent
5168 private chartUpdateSubscription ! : Subscription ;
5269 @Input ( )
5370 chartSlices ! : ChartSlices ;
71+ @Input ( )
72+ chartState : 'ready' | 'not-ready' = 'not-ready' ;
5473
5574 constructor ( ) { }
5675
0 commit comments