@@ -7,9 +7,62 @@ var transactionsOverview = new Vue({
7
7
account : 'bar' ,
8
8
balance : '' ,
9
9
question : '' ,
10
- searchitems : [ ]
10
+ searchitems : [ ] ,
11
+ areaOptions : {
12
+ series : [ ] ,
13
+ xaxis : {
14
+ type : "datetime" ,
15
+ } ,
16
+ yaxis : {
17
+ decimalsInFloat : 2
18
+ } ,
19
+ chart : {
20
+ height : 350 ,
21
+ type : "area" ,
22
+ } ,
23
+ dataLabels : {
24
+ enabled : false ,
25
+ } ,
26
+ stroke : {
27
+ curve : "smooth" ,
28
+ } ,
29
+ noData : {
30
+ text : 'Loading...'
31
+ }
32
+ } ,
33
+ areaChart : '' ,
34
+ pieOptions : {
35
+ series : [ 1 , 2 , 3 , 4 , 5 ] ,
36
+ chart : {
37
+ height : 350 ,
38
+ type : 'donut' ,
39
+ options : {
40
+ chart : {
41
+ id : "chart-id"
42
+ }
43
+ }
44
+ } ,
45
+ labels : [ 'a' , 'b' , 'c' , 'd' , 'e' ] ,
46
+ responsive : [ {
47
+ breakpoint : 480 ,
48
+ options : {
49
+ chart : {
50
+ width : 200 ,
51
+ id : "chart-id"
52
+ } ,
53
+ legend : {
54
+ position : 'bottom'
55
+ }
56
+ }
57
+ } ]
58
+ } ,
59
+ piechart :''
11
60
} ,
12
61
mounted ( ) {
62
+ this . areaChart = new ApexCharts ( document . querySelector ( "#area" ) , this . areaOptions ) ;
63
+ this . areaChart . render ( )
64
+ this . pieChart = new ApexCharts ( document . querySelector ( "#chart" ) , this . pieOptions ) ;
65
+ this . pieChart . render ( )
13
66
this . getTransactions ( )
14
67
this . connect ( )
15
68
} ,
@@ -56,6 +109,35 @@ var transactionsOverview = new Vue({
56
109
vm . items . unshift ( transactionObject )
57
110
vm . account = transactionObject . toAccount
58
111
vm . balance = transactionObject . balanceAfter
112
+
113
+ axios . get ( "/api/balance" )
114
+ . then ( function ( response ) {
115
+ vm . areaChart . updateSeries ( [ {
116
+ name : 'value' ,
117
+ data : response . data
118
+ } ] )
119
+ } )
120
+ . catch ( function ( error ) {
121
+ console . log ( 'Error! Could not reach the API. ' + error )
122
+ } )
123
+
124
+ axios . get ( "/api/biggestspenders" )
125
+ . then ( function ( response ) {
126
+
127
+ vm . pieOptions . series = response . data . series
128
+ vm . pieOptions . labels = response . data . labels
129
+
130
+ console . log ( 'pieooptons' , vm . pieOptions )
131
+
132
+ vm . pieChart . destroy ( )
133
+ vm . pieChart = new ApexCharts ( document . querySelector ( "#chart" ) , vm . pieOptions ) ;
134
+ vm . pieChart . render ( )
135
+
136
+ } )
137
+ . catch ( function ( error ) {
138
+ console . log ( 'Error! Could not reach the API. ' + error )
139
+ } )
140
+
59
141
} )
60
142
} ,
61
143
error => {
@@ -87,82 +169,4 @@ var transactionsOverview = new Vue({
87
169
}
88
170
89
171
}
90
- } )
91
-
92
- var areaOptions = {
93
- series : [ ] ,
94
- xaxis : {
95
- type : "datetime" ,
96
- } ,
97
- yaxis : {
98
- decimalsInFloat : 2
99
- } ,
100
- chart : {
101
- height : 350 ,
102
- type : "area" ,
103
- } ,
104
- dataLabels : {
105
- enabled : false ,
106
- } ,
107
- stroke : {
108
- curve : "smooth" ,
109
- } ,
110
- noData : {
111
- text : 'Loading...'
112
- }
113
- } ;
114
-
115
- var area = new ApexCharts ( document . querySelector ( "#area" ) , areaOptions ) ;
116
- area . render ( ) ;
117
- axios . get ( "/api/balance" )
118
- . then ( function ( response ) {
119
- area . updateSeries ( [ {
120
- name : 'value' ,
121
- data : response . data
122
- } ] )
123
- } )
124
- . catch ( function ( error ) {
125
- console . log ( 'Error! Could not reach the API. ' + error )
126
- } )
127
-
128
- var pieOptions = {
129
- series : [ 1 , 2 , 3 , 4 , 5 ] ,
130
- chart : {
131
- height : 350 ,
132
- type : 'donut' ,
133
- options : {
134
- chart : {
135
- id : "chart-id"
136
- }
137
- }
138
- } ,
139
- labels : [ 'a' , 'b' , 'c' , 'd' , 'e' ] ,
140
- responsive : [ {
141
- breakpoint : 480 ,
142
- options : {
143
- chart : {
144
- width : 200 ,
145
- id : "chart-id"
146
- } ,
147
- legend : {
148
- position : 'bottom'
149
- }
150
- }
151
- } ]
152
- } ;
153
-
154
- axios . get ( "/api/biggestspenders" )
155
- . then ( function ( response ) {
156
-
157
- pieOptions . series = response . data . series
158
- pieOptions . labels = response . data . labels
159
-
160
- console . log ( 'pieooptons' , pieOptions )
161
-
162
- var chart = new ApexCharts ( document . querySelector ( "#chart" ) , pieOptions ) ;
163
- chart . render ( )
164
-
165
- } )
166
- . catch ( function ( error ) {
167
- console . log ( 'Error! Could not reach the API. ' + error )
168
- } )
172
+ } )
0 commit comments