@@ -3,35 +3,43 @@ import { ThreeDChartComponent } from '@smart-webcomponents-angular/threedchart';
3
3
import { ButtonComponent } from '@smart-webcomponents-angular/button' ;
4
4
import { NumberInputComponent } from '@smart-webcomponents-angular/numberinput' ;
5
5
6
-
7
6
@Component ( {
8
7
selector : 'app-root' ,
9
8
templateUrl : './app.component.html' ,
10
- styleUrls : [ './app.component.css' ]
9
+ styleUrls : [ './app.component.css' ] ,
11
10
} )
12
-
13
11
export class AppComponent implements AfterViewInit , OnInit {
14
- @ViewChild ( 'chart' , { read : ThreeDChartComponent , static : false } ) chart ! : ThreeDChartComponent ;
15
- @ViewChild ( 'itemIndex' , { read : NumberInputComponent , static : false } ) itemIndex ! : NumberInputComponent ;
12
+ @ViewChild ( 'chart' , { read : ThreeDChartComponent , static : false } )
13
+ chart ! : ThreeDChartComponent ;
14
+ @ViewChild ( 'itemIndex' , { read : NumberInputComponent , static : false } )
15
+ itemIndex ! : NumberInputComponent ;
16
+ @ViewChild ( 'showItem' , { read : ButtonComponent , static : false } )
17
+ showItemBtn ! : ButtonComponent ;
18
+ @ViewChild ( 'hideItem' , { read : ButtonComponent , static : false } )
19
+ hideItemBtn ! : ButtonComponent ;
20
+ @ViewChild ( 'selectItem' , { read : ButtonComponent , static : false } )
21
+ selectItemBtn ! : ButtonComponent ;
22
+ @ViewChild ( 'unselectItem' , { read : ButtonComponent , static : false } )
23
+ unselectItemBtn ! : ButtonComponent ;
16
24
17
25
dataSource = [
18
- { Type : " Completed" , Count : 22 } ,
19
- { Type : " In Progress" , Count : 19 } ,
20
- { Type : " Cancelled" , Count : 13 } ,
21
- { Type : " Remaining" , Count : 34 } ,
26
+ { Type : ' Completed' , Count : 22 } ,
27
+ { Type : ' In Progress' , Count : 19 } ,
28
+ { Type : ' Cancelled' , Count : 13 } ,
29
+ { Type : ' Remaining' , Count : 34 } ,
22
30
] ;
23
31
24
- caption = " Website Project" ;
32
+ caption = ' Website Project' ;
25
33
26
- description = " Progress of the tasks" ;
34
+ description = ' Progress of the tasks' ;
27
35
28
36
showLegend = true ;
29
37
30
38
legendLayout = {
31
- flow : " vertical" ,
39
+ flow : ' vertical' ,
32
40
} ;
33
41
34
- colorScheme = " scheme01" ;
42
+ colorScheme = ' scheme01' ;
35
43
36
44
cameraPosition = {
37
45
y : 18 ,
@@ -40,13 +48,13 @@ export class AppComponent implements AfterViewInit, OnInit {
40
48
41
49
seriesGroups = [
42
50
{
43
- type : " pie" ,
51
+ type : ' pie' ,
44
52
showLabels : true ,
45
53
dataSource : this . dataSource ,
46
54
series : [
47
55
{
48
- dataField : " Count" ,
49
- displayText : " Type" ,
56
+ dataField : ' Count' ,
57
+ displayText : ' Type' ,
50
58
initialAngle : 0 ,
51
59
radius : 15 ,
52
60
labelRadius : 17 ,
@@ -57,20 +65,21 @@ export class AppComponent implements AfterViewInit, OnInit {
57
65
} ,
58
66
] ;
59
67
60
- showItem ( $event : any ) {
61
- this . chart . showItem ( this . itemIndex . value , 0 , 0 ) ;
68
+ showItem ( ) : void {
69
+ this . chart . showItem ( 0 , 0 , parseInt ( this . itemIndex . value ) ) ;
62
70
}
63
71
64
- hideItem ( $event : any ) {
65
- this . chart . hideItem ( this . itemIndex . value , 0 , 0 ) ;
72
+ hideItem ( ) : void {
73
+ this . chart . hideItem ( 0 , 0 , parseInt ( this . itemIndex . value ) ) ;
66
74
}
67
75
68
- selectItem ( $event : any ) {
69
- this . chart . selectItem ( this . itemIndex . value , 0 , 0 ) ;
76
+ selectItem ( ) : void {
77
+ this . chart . selectItem ( 0 , 0 , parseInt ( this . itemIndex . value ) ) ;
70
78
}
71
79
72
- unselectItem ( $event : any ) {
73
- this . chart . unselectItem ( this . itemIndex . value , 0 , 0 ) ;
80
+ unselectItem ( ) : void {
81
+ this . chart . unselectItem ( 0 , 0 , parseInt ( this . itemIndex . value ) ) ;
82
+
74
83
}
75
84
76
85
ngOnInit ( ) : void {
@@ -85,9 +94,25 @@ export class AppComponent implements AfterViewInit, OnInit {
85
94
init ( ) : void {
86
95
// init code.
87
96
let events = [ 'itemClick' , 'hide' , 'show' , 'unselect' , 'select' ] ;
88
- events . forEach ( ev => this . chart . addEventListener ( ev , function ( e : any ) {
89
- document . getElementById ( 'box' ) ! . innerHTML +=
90
- `${ ev } , itemIndex:${ e . detail . itemIndex } <br/>`
91
- } ) )
97
+ events . forEach ( ( ev ) =>
98
+ this . chart . addEventListener ( ev , function ( e : any ) {
99
+ document . getElementById (
100
+ 'box'
101
+ ) ! . innerHTML += `${ ev } , itemIndex:${ e . detail . itemIndex } <br/>` ;
102
+ } )
103
+ ) ;
104
+
105
+ this . showItemBtn . addEventListener ( 'click' , ( ) => {
106
+ this . showItem ( ) ;
107
+ } ) ;
108
+ this . hideItemBtn . addEventListener ( 'click' , ( ) => {
109
+ this . hideItem ( ) ;
110
+ } ) ;
111
+ this . selectItemBtn . addEventListener ( 'click' , ( ) => {
112
+ this . selectItem ( ) ;
113
+ } ) ;
114
+ this . unselectItemBtn . addEventListener ( 'click' , ( ) => {
115
+ this . unselectItem ( ) ;
116
+ } ) ;
92
117
}
93
- }
118
+ }
0 commit comments