File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
samples/charts/data-pie-chart/others/src Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ export class EnergyGlobalDemandItem {
2
+ public constructor ( init : Partial < EnergyGlobalDemandItem > ) {
3
+ Object . assign ( this , init ) ;
4
+ }
5
+
6
+ public value : number ;
7
+ public category : string ;
8
+ public summary : string ;
9
+
10
+ }
11
+ export class EnergyGlobalDemand extends Array < EnergyGlobalDemandItem > {
12
+ public constructor ( items : Array < EnergyGlobalDemandItem > | number = - 1 ) {
13
+ if ( Array . isArray ( items ) ) {
14
+ super ( ...items ) ;
15
+ } else {
16
+ const newItems = [
17
+ new EnergyGlobalDemandItem (
18
+ {
19
+ value : 37 ,
20
+ category : `Cooling` ,
21
+ summary : `Cooling 37%`
22
+ } ) ,
23
+ new EnergyGlobalDemandItem (
24
+ {
25
+ value : 25 ,
26
+ category : `Residential` ,
27
+ summary : `Residential 25%`
28
+ } ) ,
29
+ new EnergyGlobalDemandItem (
30
+ {
31
+ value : 12 ,
32
+ category : `Heating` ,
33
+ summary : `Heating 12%`
34
+ } ) ,
35
+ new EnergyGlobalDemandItem (
36
+ {
37
+ value : 11 ,
38
+ category : `Lighting` ,
39
+ summary : `Lighting 11%`
40
+ } ) ,
41
+ new EnergyGlobalDemandItem (
42
+ {
43
+ value : 15 ,
44
+ category : `Other` ,
45
+ summary : `Other 15%`
46
+ } ) ,
47
+ ] ;
48
+ super ( ...newItems . slice ( 0 ) ) ;
49
+ }
50
+ }
51
+ }
You can’t perform that action at this time.
0 commit comments