@@ -17,7 +17,7 @@ var transactionsOverview = new Vue({
17
17
decimalsInFloat : 2
18
18
} ,
19
19
chart : {
20
- height : 300 ,
20
+ height : 200 ,
21
21
type : "area" ,
22
22
} ,
23
23
dataLabels : {
@@ -34,7 +34,7 @@ var transactionsOverview = new Vue({
34
34
pieOptions : {
35
35
series : [ ] ,
36
36
chart : {
37
- height : 300 ,
37
+ height : 200 ,
38
38
type : 'donut' ,
39
39
options : {
40
40
chart : {
@@ -67,7 +67,7 @@ var transactionsOverview = new Vue({
67
67
this . areaChart . render ( )
68
68
this . pieChart = new ApexCharts ( document . querySelector ( "#chart" ) , this . pieOptions ) ;
69
69
this . pieChart . render ( )
70
- this . getTransactions ( )
70
+ this . getInitialData ( )
71
71
this . connect ( )
72
72
} ,
73
73
watch : {
@@ -81,7 +81,7 @@ var transactionsOverview = new Vue({
81
81
this . debouncedGetAnswer = _ . debounce ( this . getAnswer , 100 )
82
82
} ,
83
83
methods : {
84
- getTransactions : function ( ) {
84
+ getInitialData : function ( ) {
85
85
var transactionsUrl = '/api/transactions'
86
86
var vm = this
87
87
axios . get ( transactionsUrl )
@@ -93,6 +93,34 @@ var transactionsOverview = new Vue({
93
93
. catch ( function ( error ) {
94
94
console . log ( 'Error! Could not reach the API. ' + error )
95
95
} )
96
+
97
+ axios . get ( "/api/balance" )
98
+ . then ( function ( response ) {
99
+ vm . areaChart . updateSeries ( [ {
100
+ name : 'value' ,
101
+ data : response . data
102
+ } ] )
103
+ } )
104
+ . catch ( function ( error ) {
105
+ console . log ( 'Error! Could not reach the API. ' + error )
106
+ } )
107
+
108
+ axios . get ( "/api/biggestspenders" )
109
+ . then ( function ( response ) {
110
+
111
+ vm . pieOptions . series = response . data . series
112
+ vm . pieOptions . labels = response . data . labels
113
+
114
+ console . log ( 'pieooptons' , vm . pieOptions )
115
+
116
+ vm . pieChart . destroy ( )
117
+ vm . pieChart = new ApexCharts ( document . querySelector ( "#chart" ) , vm . pieOptions ) ;
118
+ vm . pieChart . render ( )
119
+
120
+ } )
121
+ . catch ( function ( error ) {
122
+ console . log ( 'Error! Could not reach the API. ' + error )
123
+ } )
96
124
} ,
97
125
connect : function ( ) {
98
126
var vm = this
0 commit comments