|
8 | 8 | $scope.visitor_count = 0; |
9 | 9 | $scope.user_count = 0; |
10 | 10 |
|
| 11 | + $scope.chart; |
| 12 | + |
11 | 13 | $scope.field = "date"; |
12 | 14 | $scope.rows = "10"; |
13 | 15 |
|
|
53 | 55 | $scope.period_start.setDate($scope.period_end.getDate() - 7); |
54 | 56 |
|
55 | 57 | $scope.getDashboard(); |
| 58 | + $scope.getReport(); |
56 | 59 | }; |
57 | 60 | $scope.lastMonth = function () { |
58 | 61 | $scope.period_end = new Date(); |
59 | 62 | $scope.period_start = new Date(); |
60 | 63 | $scope.period_start.setDate($scope.period_end.getDate() - 30); |
61 | 64 |
|
62 | 65 | $scope.getDashboard(); |
| 66 | + $scope.getReport(); |
63 | 67 | }; |
64 | 68 | $scope.last3Months = function () { |
65 | 69 | $scope.period_end = new Date(); |
66 | 70 | $scope.period_start = new Date(); |
67 | 71 | $scope.period_start.setDate($scope.period_end.getDate() - 90); |
68 | 72 |
|
69 | 73 | $scope.getDashboard(); |
| 74 | + $scope.getReport(); |
70 | 75 | }; |
71 | 76 |
|
72 | 77 | $scope.getDashboard = function () { |
|
78 | 83 | function (response) { |
79 | 84 | var dashboardDTO = response.data; |
80 | 85 |
|
81 | | - console.log(dashboardDTO); |
| 86 | + //console.log(dashboardDTO); |
82 | 87 |
|
83 | 88 | $scope.view_count = dashboardDTO.view_count; |
84 | 89 | $scope.visit_count = dashboardDTO.visit_count; |
|
169 | 174 | } |
170 | 175 | $scope.chart_data = [views, visits, visitors, users]; |
171 | 176 |
|
| 177 | + $scope.chart.update(); |
172 | 178 | $scope.dashboard_loading = false; |
173 | 179 | }, |
174 | 180 | function (response) { |
|
190 | 196 | function (response) { |
191 | 197 | $scope.report_rows = response.data; |
192 | 198 |
|
193 | | - console.log($scope.report_rows); |
| 199 | + //console.log($scope.report_rows); |
194 | 200 |
|
195 | 201 | $scope.pie_chart_labels = []; |
196 | 202 | $scope.pie_chart_data = []; |
|
224 | 230 | $scope.getReport(); |
225 | 231 | }; |
226 | 232 |
|
| 233 | + $scope.$on('chart-create', function (evt, chart) { |
| 234 | + $scope.chart = chart; |
| 235 | + }); |
| 236 | + |
227 | 237 | init = function () { |
228 | 238 | var promises = []; |
229 | 239 | return $q.all(promises); |
230 | 240 | }; |
231 | 241 | init(); |
232 | 242 | $scope.lastWeek(); |
233 | 243 | $scope.getReport(); |
234 | | - |
235 | 244 | }]); |
236 | 245 |
|
0 commit comments