Commit b944d384c369a39c2d24833654553aa6e24bb5ce
1 parent
75d1c3d9f2
Exists in
master
analytics UI
Showing
2 changed files
with
67 additions
and
22 deletions
Show diff stats
app/partials/analytics/analytics.controller.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | angular.module('acufuel') | 2 | angular.module('acufuel') |
3 | .controller('analyticsController', ['$scope','analyticsService',function($scope, analyticsService) { | 3 | .controller('analyticsController', ['$scope','analyticsService',function($scope, analyticsService) { |
4 | 4 | ||
5 | $(document).ready(function(){ | 5 | $(document).ready(function(){ |
6 | $(function(){ | 6 | $(function(){ |
7 | new jvm.MultiMap({ | 7 | new jvm.MultiMap({ |
8 | container: $('#map'), | 8 | container: $('#map'), |
9 | maxLevel: 1, | 9 | maxLevel: 1, |
10 | main: { | 10 | main: { |
11 | map: 'us_lcc', | 11 | map: 'us_lcc', |
12 | backgroundColor: '#ffce99', | 12 | backgroundColor: '#ffce99', |
13 | }, | 13 | }, |
14 | mapUrlByCode: function(code, multiMap){ | 14 | mapUrlByCode: function(code, multiMap){ |
15 | console.log('-----s-----s-s--',code.toLowerCase()) | ||
15 | return '/js/us-counties/jquery-jvectormap-data-'+ | 16 | return '/js/us-counties/jquery-jvectormap-data-'+ |
16 | code.toLowerCase()+'-'+ | 17 | code.toLowerCase()+'-'+ |
17 | multiMap.defaultProjection+'-en.js'; | 18 | multiMap.defaultProjection+'-en.js'; |
18 | } | 19 | }, |
20 | onRegionClick:function(event, code) { | ||
21 | var name = (code); | ||
22 | alert(name); | ||
23 | } | ||
19 | }); | 24 | }); |
25 | |||
20 | }); | 26 | }); |
21 | }) | 27 | }) |
22 | 28 | ||
23 | 29 | ||
24 | $scope.drf = {}; | 30 | $scope.drf = {}; |
25 | $scope.hfp = {}; | 31 | $scope.hfp = {}; |
26 | $scope.cs = {}; | 32 | $scope.cs = {}; |
27 | $scope.mfsValues = []; | 33 | $scope.mfsValues = []; |
28 | $scope.msfarray=[]; | 34 | $scope.msfarray=[]; |
29 | $scope.getMFS = function(){ | 35 | $scope.getMFS = function(){ |
30 | //var makeId = makeId; | 36 | //var makeId = makeId; |
31 | analyticsService.getMFS().then(function(result) { | 37 | analyticsService.getMFS().then(function(result) { |
32 | $scope.mfsValues = result; | 38 | $scope.mfsValues = result; |
33 | 39 | ||
34 | //console.log("msf length",$scope.mfsValues.length); | 40 | //console.log("msf length",$scope.mfsValues.length); |
35 | //console.log("mfs data kd--- ",$scope.mfsValues) | 41 | //console.log("mfs data kd--- ",$scope.mfsValues) |
36 | 42 | ||
37 | //console.log("==msf data key==",$scope.mfsValues[0].key); | 43 | //console.log("==msf data key==",$scope.mfsValues[0].key); |
38 | // console.log("==msf data values==",$scope.mfsValues[0].values); | 44 | // console.log("==msf data values==",$scope.mfsValues[0].values); |
39 | // console.log("==x===",$scope.mfsValues[0].values[0].x); | 45 | // console.log("==x===",$scope.mfsValues[0].values[0].x); |
40 | //console.log("==y===",$scope.mfsValues[0].values[0].y); | 46 | //console.log("==y===",$scope.mfsValues[0].values[0].y); |
41 | // console.log("==x===",$scope.mfsValues[0].values[1].x); | 47 | // console.log("==x===",$scope.mfsValues[0].values[1].x); |
42 | // console.log("==y===",$scope.mfsValues[0].values[1].y); | 48 | // console.log("==y===",$scope.mfsValues[0].values[1].y); |
43 | /* $scope.optionsmfs = { | 49 | /* $scope.optionsmfs = { |
44 | chart: { | 50 | chart: { |
45 | type: 'discreteBarChart', | 51 | type: 'discreteBarChart', |
46 | height: 450, | 52 | height: 450, |
47 | margin : { | 53 | margin : { |
48 | top: 20, | 54 | top: 20, |
49 | right: 20, | 55 | right: 20, |
50 | bottom: 60, | 56 | bottom: 60, |
51 | left: 55, | 57 | left: 55, |
52 | }, | 58 | }, |
53 | x: function(d){ return d.label; }, | 59 | x: function(d){ return d.label; }, |
54 | y: function(d){ return d.value; }, | 60 | y: function(d){ return d.value; }, |
55 | showValues: false, | 61 | showValues: false, |
56 | valueFormat: function(d){ | 62 | valueFormat: function(d){ |
57 | return d3.format(',.4f')(d); | 63 | return d3.format(',.4f')(d); |
58 | }, | 64 | }, |
59 | transitionDuration: 500, | 65 | transitionDuration: 500, |
60 | xAxis: { | 66 | xAxis: { |
61 | axisLabel: 'X Axis' | 67 | axisLabel: 'X Axis' |
62 | }, | 68 | }, |
63 | yAxis: { | 69 | yAxis: { |
64 | axisLabel: 'Y Axis', | 70 | axisLabel: 'Y Axis', |
65 | axisLabelDistance: 30 | 71 | axisLabelDistance: 30 |
66 | } | 72 | } |
67 | } | 73 | } |
68 | }; | 74 | }; |
69 | 75 | ||
70 | $scope.datamfs = [{ | 76 | $scope.datamfs = [{ |
71 | key: "Cumulative Return", | 77 | key: "Cumulative Return", |
72 | values: $scope.mfsValues | 78 | values: $scope.mfsValues |
73 | }] */ | 79 | }] */ |
74 | 80 | ||
75 | $scope.optionsmfs = { | 81 | $scope.optionsmfs = { |
76 | chart: { | 82 | chart: { |
77 | type: 'multiBarChart', | 83 | type: 'multiBarChart', |
78 | height: 450, | 84 | height: 450, |
79 | margin : { | 85 | margin : { |
80 | top: 20, | 86 | top: 20, |
81 | right: 20, | 87 | right: 20, |
82 | bottom: 45, | 88 | bottom: 45, |
83 | left: 45 | 89 | left: 45 |
84 | }, | 90 | }, |
85 | clipEdge: true, | 91 | clipEdge: true, |
86 | //staggerLabels: true, | 92 | //staggerLabels: true, |
87 | duration: 500, | 93 | duration: 500, |
88 | stacked: true, | 94 | stacked: true, |
89 | color: ["#FEDFC3","#990000","#000099","#009900"], | 95 | color: ["#FEDFC3","#990000","#000099","#009900"], |
90 | xAxis: { | 96 | xAxis: { |
91 | axisLabel: 'Months', | 97 | axisLabel: 'Months', |
92 | showMaxMin: false, | 98 | showMaxMin: false, |
93 | }, | 99 | }, |
94 | yAxis: { | 100 | yAxis: { |
95 | axisLabel: 'Y Axis', | 101 | axisLabel: 'Y Axis', |
96 | axisLabelDistance: -20, | 102 | axisLabelDistance: -20, |
97 | tickFormat: function(d){ | 103 | tickFormat: function(d){ |
98 | return d3.format(',.1f')(d); | 104 | return d3.format(',.1f')(d); |
99 | } | 105 | } |
100 | } | 106 | } |
101 | } | 107 | } |
102 | }; | 108 | }; |
103 | 109 | ||
104 | 110 | ||
105 | //console.log("==length 1==",$scope.mfsValues); | 111 | //console.log("==length 1==",$scope.mfsValues); |
106 | 112 | ||
107 | for (var i = 0; i < $scope.mfsValues.length; i++) { | 113 | for (var i = 0; i < $scope.mfsValues.length; i++) { |
108 | for(var j=0;j<$scope.mfsValues[i].values.length;j++){ | 114 | for(var j=0;j<$scope.mfsValues[i].values.length;j++){ |
109 | 115 | ||
110 | $scope.msfarray.push({ | 116 | $scope.msfarray.push({ |
111 | "key":$scope.mfsValues[i].key, | 117 | "key":$scope.mfsValues[i].key, |
112 | "values": [{ | 118 | "values": [{ |
113 | "x":$scope.mfsValues[i].values[j].x, | 119 | "x":$scope.mfsValues[i].values[j].x, |
114 | "y":$scope.mfsValues[i].values[j].y | 120 | "y":$scope.mfsValues[i].values[j].y |
115 | }] | 121 | }] |
116 | }) | 122 | }) |
117 | } | 123 | } |
118 | 124 | ||
119 | 125 | ||
120 | } | 126 | } |
121 | // console.log("new values===",$scope.msfarray); | 127 | // console.log("new values===",$scope.msfarray); |
122 | $scope.datamfs=$scope.msfarray; | 128 | $scope.datamfs=$scope.msfarray; |
123 | 129 | ||
124 | 130 | ||
125 | /*$scope.datamfs = [{ | 131 | /*$scope.datamfs = [{ |
126 | "key": "Pending", | 132 | "key": "Pending", |
127 | "values": [{ | 133 | "values": [{ |
128 | "x": "Jan", | 134 | "x": "Jan", |
129 | "y": 0.16284738584101344 | 135 | "y": 0.16284738584101344 |
130 | }, { | 136 | }, { |
131 | "x": "Feb", | 137 | "x": "Feb", |
132 | "y": 2.370283172738109 | 138 | "y": 2.370283172738109 |
133 | }, { | 139 | }, { |
134 | "x": "Mar", | 140 | "x": "Mar", |
135 | "y": 0.1631208266452718 | 141 | "y": 0.1631208266452718 |
136 | }, { | 142 | }, { |
137 | "x": "Apr", | 143 | "x": "Apr", |
138 | "y": 0.24609871793543797 | 144 | "y": 0.24609871793543797 |
139 | }, { | 145 | }, { |
140 | "x": "May", | 146 | "x": "May", |
141 | "y": 1.5096133160633776 | 147 | "y": 1.5096133160633776 |
142 | },{ | 148 | },{ |
143 | "x": "Jun", | 149 | "x": "Jun", |
144 | "y": 0.16284738584101344 | 150 | "y": 0.16284738584101344 |
145 | }, { | 151 | }, { |
146 | "x": "Jul", | 152 | "x": "Jul", |
147 | "y": 2.370283172738109 | 153 | "y": 2.370283172738109 |
148 | }, { | 154 | }, { |
149 | "x": "Aug", | 155 | "x": "Aug", |
150 | "y": 0.1631208266452718 | 156 | "y": 0.1631208266452718 |
151 | }, { | 157 | }, { |
152 | "x": "Sep", | 158 | "x": "Sep", |
153 | "y": 0.24609871793543797 | 159 | "y": 0.24609871793543797 |
154 | }, { | 160 | }, { |
155 | "x": "Oct", | 161 | "x": "Oct", |
156 | "y": 1.5096133160633776 | 162 | "y": 1.5096133160633776 |
157 | }, { | 163 | }, { |
158 | "x": "Nov", | 164 | "x": "Nov", |
159 | "y": 0.24609871793543797 | 165 | "y": 0.24609871793543797 |
160 | }, { | 166 | }, { |
161 | "x": "Dec", | 167 | "x": "Dec", |
162 | "y": 1.5096133160633776 | 168 | "y": 1.5096133160633776 |
163 | }] | 169 | }] |
164 | }, { | 170 | }, { |
165 | "key": "Cancelled", | 171 | "key": "Cancelled", |
166 | "values": [{ | 172 | "values": [{ |
167 | "x": "Jan", | 173 | "x": "Jan", |
168 | "y": 0.12566330679904006 | 174 | "y": 0.12566330679904006 |
169 | }, { | 175 | }, { |
170 | "x": "Feb", | 176 | "x": "Feb", |
171 | "y": 0.1321859413211272 | 177 | "y": 0.1321859413211272 |
172 | }, { | 178 | }, { |
173 | "x": "Mar", | 179 | "x": "Mar", |
174 | "y": 1.4798247902549135 | 180 | "y": 1.4798247902549135 |
175 | }, { | 181 | }, { |
176 | "x": "Apr", | 182 | "x": "Apr", |
177 | "y": 0.10870538273358979 | 183 | "y": 0.10870538273358979 |
178 | }, { | 184 | }, { |
179 | "x": "May", | 185 | "x": "May", |
180 | "y": 0.16155091711225184 | 186 | "y": 0.16155091711225184 |
181 | },{ | 187 | },{ |
182 | "x": "Jun", | 188 | "x": "Jun", |
183 | "y": 0.16284738584101344 | 189 | "y": 0.16284738584101344 |
184 | }, { | 190 | }, { |
185 | "x": "Jul", | 191 | "x": "Jul", |
186 | "y": 2.370283172738109 | 192 | "y": 2.370283172738109 |
187 | }, { | 193 | }, { |
188 | "x": "Aug", | 194 | "x": "Aug", |
189 | "y": 0.1631208266452718 | 195 | "y": 0.1631208266452718 |
190 | }, { | 196 | }, { |
191 | "x": "Sep", | 197 | "x": "Sep", |
192 | "y": 0.24609871793543797 | 198 | "y": 0.24609871793543797 |
193 | }, { | 199 | }, { |
194 | "x": "Oct", | 200 | "x": "Oct", |
195 | "y": 1.5096133160633776 | 201 | "y": 1.5096133160633776 |
196 | }, { | 202 | }, { |
197 | "x": "Nov", | 203 | "x": "Nov", |
198 | "y": 0.24609871793543797 | 204 | "y": 0.24609871793543797 |
199 | }, { | 205 | }, { |
200 | "x": "Dec", | 206 | "x": "Dec", |
201 | "y": 1.5096133160633776 | 207 | "y": 1.5096133160633776 |
202 | }] | 208 | }] |
203 | },{ | 209 | },{ |
204 | "key": "Invoiced", | 210 | "key": "Invoiced", |
205 | "values": [{ | 211 | "values": [{ |
206 | "x": "Jan", | 212 | "x": "Jan", |
207 | "y": 0.16284738584101344 | 213 | "y": 0.16284738584101344 |
208 | }, { | 214 | }, { |
209 | "x": "Feb", | 215 | "x": "Feb", |
210 | "y": 2.370283172738109 | 216 | "y": 2.370283172738109 |
211 | }, { | 217 | }, { |
212 | "x": "Mar", | 218 | "x": "Mar", |
213 | "y": 0.1631208266452718 | 219 | "y": 0.1631208266452718 |
214 | }, { | 220 | }, { |
215 | "x": "Apr", | 221 | "x": "Apr", |
216 | "y": 0.24609871793543797 | 222 | "y": 0.24609871793543797 |
217 | }, { | 223 | }, { |
218 | "x": "May", | 224 | "x": "May", |
219 | "y": 1.5096133160633776 | 225 | "y": 1.5096133160633776 |
220 | },{ | 226 | },{ |
221 | "x": "Jun", | 227 | "x": "Jun", |
222 | "y": 0.16284738584101344 | 228 | "y": 0.16284738584101344 |
223 | }, { | 229 | }, { |
224 | "x": "Jul", | 230 | "x": "Jul", |
225 | "y": 2.370283172738109 | 231 | "y": 2.370283172738109 |
226 | }, { | 232 | }, { |
227 | "x": "Aug", | 233 | "x": "Aug", |
228 | "y": 0.1631208266452718 | 234 | "y": 0.1631208266452718 |
229 | }, { | 235 | }, { |
230 | "x": "Sep", | 236 | "x": "Sep", |
231 | "y": 0.24609871793543797 | 237 | "y": 0.24609871793543797 |
232 | }, { | 238 | }, { |
233 | "x": "Oct", | 239 | "x": "Oct", |
234 | "y": 1.5096133160633776 | 240 | "y": 1.5096133160633776 |
235 | }, { | 241 | }, { |
236 | "x": "Nov", | 242 | "x": "Nov", |
237 | "y": 0.24609871793543797 | 243 | "y": 0.24609871793543797 |
238 | }, { | 244 | }, { |
239 | "x": "Dec", | 245 | "x": "Dec", |
240 | "y": 1.5096133160633776 | 246 | "y": 1.5096133160633776 |
241 | }] | 247 | }] |
242 | }, { | 248 | }, { |
243 | "key": "Paid", | 249 | "key": "Paid", |
244 | "values": [{ | 250 | "values": [{ |
245 | "x": "Jan", | 251 | "x": "Jan", |
246 | "y": 0.12566330679904006 | 252 | "y": 0.12566330679904006 |
247 | }, { | 253 | }, { |
248 | "x": "Feb", | 254 | "x": "Feb", |
249 | "y": 0.1321859413211272 | 255 | "y": 0.1321859413211272 |
250 | }, { | 256 | }, { |
251 | "x": "Mar", | 257 | "x": "Mar", |
252 | "y": 1.4798247902549135 | 258 | "y": 1.4798247902549135 |
253 | }, { | 259 | }, { |
254 | "x": "Apr", | 260 | "x": "Apr", |
255 | "y": 0.10870538273358979 | 261 | "y": 0.10870538273358979 |
256 | }, { | 262 | }, { |
257 | "x": "May", | 263 | "x": "May", |
258 | "y": 0.16155091711225184 | 264 | "y": 0.16155091711225184 |
259 | },{ | 265 | },{ |
260 | "x": "Jun", | 266 | "x": "Jun", |
261 | "y": 0.16284738584101344 | 267 | "y": 0.16284738584101344 |
262 | }, { | 268 | }, { |
263 | "x": "Jul", | 269 | "x": "Jul", |
264 | "y": 2.370283172738109 | 270 | "y": 2.370283172738109 |
265 | }, { | 271 | }, { |
266 | "x": "Aug", | 272 | "x": "Aug", |
267 | "y": 0.1631208266452718 | 273 | "y": 0.1631208266452718 |
268 | }, { | 274 | }, { |
269 | "x": "Sep", | 275 | "x": "Sep", |
270 | "y": 0.24609871793543797 | 276 | "y": 0.24609871793543797 |
271 | }, { | 277 | }, { |
272 | "x": "Oct", | 278 | "x": "Oct", |
273 | "y": 1.5096133160633776 | 279 | "y": 1.5096133160633776 |
274 | }, { | 280 | }, { |
275 | "x": "Nov", | 281 | "x": "Nov", |
276 | "y": 0.24609871793543797 | 282 | "y": 0.24609871793543797 |
277 | }, { | 283 | }, { |
278 | "x": "Dec", | 284 | "x": "Dec", |
279 | "y": 1.5096133160633776 | 285 | "y": 1.5096133160633776 |
280 | }] | 286 | }] |
281 | }] | 287 | }] |
282 | */ | 288 | */ |
283 | }) | 289 | }) |
284 | } | 290 | } |
285 | 291 | ||
286 | 292 | ||
287 | 293 | ||
288 | 294 | ||
289 | $scope.getMFS(); | 295 | $scope.getMFS(); |
290 | $scope.csValues = []; | 296 | $scope.csValues = []; |
291 | $scope.getCS = function(){ | 297 | $scope.getCS = function(){ |
292 | //var makeId = makeId; | 298 | //var makeId = makeId; |
293 | analyticsService.getCS().then(function(result) { | 299 | analyticsService.getCS().then(function(result) { |
300 | console.log("==cs values==",result) | ||
294 | $scope.csValues = result; | 301 | $scope.csValues = result; |
295 | //console.log("cs data kd --- ",$scope.csValues) | 302 | //console.log("cs data kd --- ",$scope.csValues) |
296 | $scope.optionscs = { | 303 | $scope.optionscs = { |
297 | chart: { | 304 | chart: { |
298 | type: 'pieChart', | 305 | type: 'pieChart', |
299 | height: 500, | 306 | height: 500, |
300 | // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], | 307 | // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], |
301 | x: function(d){return d.key;}, | 308 | x: function(d){return d.key;}, |
302 | y: function(d){return d.y;}, | 309 | y: function(d){return d.y;}, |
303 | showLabels: false, | 310 | showLabels: false, |
304 | segmentShowStroke : false, | 311 | segmentShowStroke : false, |
305 | animationSteps : 20, | 312 | animationSteps : 20, |
306 | animationEasing : "linear", | 313 | animationEasing : "linear", |
307 | animateScale : true, | 314 | animateScale : true, |
308 | duration: 500, | 315 | duration: 500, |
309 | labelThreshold: 0.01, | 316 | labelThreshold: 0.01, |
310 | labelSunbeamLayout: true, | 317 | labelSunbeamLayout: true, |
311 | legend: { | 318 | legend: { |
312 | margin: { | 319 | margin: { |
313 | top: 5, | 320 | top: 5, |
314 | right: 35, | 321 | right: 35, |
315 | bottom: 5, | 322 | bottom: 5, |
316 | left: 0 | 323 | left: 0 |
317 | } | 324 | } |
318 | } | 325 | } |
319 | } | 326 | } |
320 | }; | 327 | }; |
321 | $scope.datacs = $scope.csValues; | 328 | $scope.datacs = $scope.csValues; |
322 | }) | 329 | }) |
323 | } | 330 | } |
324 | 331 | ||
325 | $scope.getCS(); | 332 | $scope.getCS(); |
333 | |||
334 | /*Historic Fuel Price */ | ||
326 | $scope.optionshfp = { | 335 | $scope.optionshfp = { |
327 | chart: { | 336 | chart: { |
328 | type: 'cumulativeLineChart', | 337 | type: 'cumulativeLineChart', |
329 | height: 450, | 338 | height: 450, |
330 | margin : { | 339 | margin : { |
331 | top: 20, | 340 | top: 20, |
332 | right: 20, | 341 | right: 20, |
333 | bottom: 50, | 342 | bottom: 50, |
334 | left: 65 | 343 | left: 65 |
335 | }, | 344 | }, |
336 | x: function(d){ return d[0]; }, | 345 | x: function(d){ return d[0]; }, |
337 | y: function(d){ return d[1]/100; }, | 346 | y: function(d){ return d[1]/100; }, |
338 | average: function(d) { return d.mean/100; }, | 347 | average: function(d) { return d.mean/100; }, |
339 | 348 | ||
340 | color: ["#FEDFC3"], | 349 | color: ["#FEDFC3"], |
341 | duration: 300, | 350 | duration: 300, |
342 | useInteractiveGuideline: true, | 351 | useInteractiveGuideline: true, |
343 | clipVoronoi: false, | 352 | clipVoronoi: false, |
344 | 353 | ||
345 | xAxis: { | 354 | xAxis: { |
346 | axisLabel: 'X Axis', | 355 | axisLabel: 'X Axis', |
347 | tickFormat: function(d) { | 356 | tickFormat: function(d) { |
348 | return d3.time.format('%m/%d/%y')(new Date(d)) | 357 | return d3.time.format('%m/%d/%y')(new Date(d)) |
349 | }, | 358 | }, |
350 | showMaxMin: false, | 359 | showMaxMin: false, |
351 | staggerLabels: true | 360 | staggerLabels: true |
352 | }, | 361 | }, |
353 | 362 | ||
354 | yAxis: { | 363 | yAxis: { |
355 | axisLabel: 'Y Axis', | 364 | axisLabel: 'Y Axis', |
356 | tickFormat: function(d){ | 365 | tickFormat: function(d){ |
357 | return d3.format(',.1%')(d); | 366 | return d3.format(',.1%')(d); |
358 | }, | 367 | }, |
359 | axisLabelDistance: 0 | 368 | axisLabelDistance: 0 |
360 | } | 369 | } |
361 | } | 370 | } |
362 | }; | 371 | }; |
363 | 372 | ||
364 | $scope.datahfp = | 373 | $scope.datahfp = |
365 | [{ | 374 | [{ |
366 | key: "Long", | 375 | key: "Long", |
367 | values: [ [ 1083297600000 , -2.974623048543] , [ 1085976000000 , -1.7740300785979] , [ 1088568000000 , 4.4681318138177] , [ 1091246400000 , 7.0242541001353] , [ 1093924800000 , 7.5709603667586] , [ 1096516800000 , 20.612245065736] , [ 1099195200000 , 21.698065237316] , [ 1101790800000 , 40.501189458018] , [ 1104469200000 , 50.464679413194] , [ 1107147600000 , 48.917421973355] , [ 1109566800000 , 63.750936549160] , [ 1112245200000 , 59.072499126460] , [ 1114833600000 , 43.373158880492] , [ 1117512000000 , 54.490918947556] , [ 1120104000000 , 56.661178852079] , [ 1122782400000 , 73.450103545496] , [ 1125460800000 , 71.714526354907] , [ 1128052800000 , 85.221664349607] , [ 1130734800000 , 77.769261392481] , [ 1133326800000 , 95.966528716500] , [ 1136005200000 , 107.59132116397] , [ 1138683600000 , 127.25740096723] , [ 1141102800000 , 122.13917498830] , [ 1143781200000 , 126.53657279774] , [ 1146369600000 , 132.39300992970] , [ 1149048000000 , 120.11238242904] , [ 1151640000000 , 118.41408917750] , [ 1154318400000 , 107.92918924621] , [ 1156996800000 , 110.28057249569] , [ 1159588800000 , 117.20485334692] , [ 1162270800000 , 141.33556756948] , [ 1164862800000 , 159.59452727893] , [ 1167541200000 , 167.09801853304] , [ 1170219600000 , 185.46849659215] , [ 1172638800000 , 184.82474099990] , [ 1175313600000 , 195.63155213887] , [ 1177905600000 , 207.40597044171] , [ 1180584000000 , 230.55966698196] , [ 1183176000000 , 239.55649035292] , [ 1185854400000 , 241.35915085208] , [ 1188532800000 , 239.89428956243] , [ 1191124800000 , 260.47781917715] , [ 1193803200000 , 276.39457482225] , [ 1196398800000 , 258.66530682672] , [ 1199077200000 , 250.98846121893] , [ 1201755600000 , 226.89902618127] , [ 1204261200000 , 227.29009273807] , [ 1206936000000 , 218.66476654350] , [ 1209528000000 , 232.46605902918] , [ 1212206400000 , 253.25667081117] , [ 1214798400000 , 235.82505363925] , [ 1217476800000 , 229.70112774254] , [ 1220155200000 , 225.18472705952] , [ 1222747200000 , 189.13661746552] , [ 1225425600000 , 149.46533007301] , [ 1228021200000 , 131.00340772114] , [ 1230699600000 , 135.18341728866] , [ 1233378000000 , 109.15296887173] , [ 1235797200000 , 84.614772549760] , [ 1238472000000 , 100.60810015326] , [ 1241064000000 , 141.50134895610] , [ 1243742400000 , 142.50405083675] , [ 1246334400000 , 139.81192372672] , [ 1249012800000 , 177.78205544583] , [ 1251691200000 , 194.73691933074] , [ 1254283200000 , 209.00838460225] , [ 1256961600000 , 198.19855877420] , [ 1259557200000 , 222.37102417812] , [ 1262235600000 , 234.24581081250] , [ 1264914000000 , 228.26087689346] , [ 1267333200000 , 248.81895126250] , [ 1270008000000 , 270.57301075186] , [ 1272600000000 , 292.64604322550] , [ 1275278400000 , 265.94088520518] , [ 1277870400000 , 237.82887467569] , [ 1280548800000 , 265.55973314204] , [ 1283227200000 , 248.30877330928] , [ 1285819200000 , 278.14870066912] , [ 1288497600000 , 292.69260960288] , [ 1291093200000 , 300.84263809599] , [ 1293771600000 , 326.17253914628] , [ 1296450000000 , 337.69335966505] , [ 1298869200000 , 339.73260965121] , [ 1301544000000 , 346.87865120765] , [ 1304136000000 , 347.92991526628] , [ 1306814400000 , 342.04627502669] , [ 1309406400000 , 333.45386231233] , [ 1312084800000 , 323.15034181243] , [ 1314763200000 , 295.66126882331] , [ 1317355200000 , 251.48014579253] , [ 1320033600000 , 295.15424257905] , [ 1322629200000 , 294.54766764397] , [ 1325307600000 , 295.72906119051] , [ 1327986000000 , 325.73351347613] , [ 1330491600000 , 340.16106061186] , [ 1333166400000 , 345.15514071490] , [ 1335758400000 , 337.10259395679] , [ 1338436800000 , 318.68216333837] , [ 1341028800000 , 317.03683945246] , [ 1343707200000 , 318.53549659997] , [ 1346385600000 , 332.85381464104] , [ 1348977600000 , 337.36534373477] , [ 1351656000000 , 350.27872156161] , [ 1354251600000 , 349.45128876100]] | 376 | values: [ [ 1083297600000 , -2.974623048543] , [ 1085976000000 , -1.7740300785979] , [ 1088568000000 , 4.4681318138177] , [ 1091246400000 , 7.0242541001353] , [ 1093924800000 , 7.5709603667586] , [ 1096516800000 , 20.612245065736] , [ 1099195200000 , 21.698065237316] , [ 1101790800000 , 40.501189458018] , [ 1104469200000 , 50.464679413194] , [ 1107147600000 , 48.917421973355] , [ 1109566800000 , 63.750936549160] , [ 1112245200000 , 59.072499126460] , [ 1114833600000 , 43.373158880492] , [ 1117512000000 , 54.490918947556] , [ 1120104000000 , 56.661178852079] , [ 1122782400000 , 73.450103545496] , [ 1125460800000 , 71.714526354907] , [ 1128052800000 , 85.221664349607] , [ 1130734800000 , 77.769261392481] , [ 1133326800000 , 95.966528716500] , [ 1136005200000 , 107.59132116397] , [ 1138683600000 , 127.25740096723] , [ 1141102800000 , 122.13917498830] , [ 1143781200000 , 126.53657279774] , [ 1146369600000 , 132.39300992970] , [ 1149048000000 , 120.11238242904] , [ 1151640000000 , 118.41408917750] , [ 1154318400000 , 107.92918924621] , [ 1156996800000 , 110.28057249569] , [ 1159588800000 , 117.20485334692] , [ 1162270800000 , 141.33556756948] , [ 1164862800000 , 159.59452727893] , [ 1167541200000 , 167.09801853304] , [ 1170219600000 , 185.46849659215] , [ 1172638800000 , 184.82474099990] , [ 1175313600000 , 195.63155213887] , [ 1177905600000 , 207.40597044171] , [ 1180584000000 , 230.55966698196] , [ 1183176000000 , 239.55649035292] , [ 1185854400000 , 241.35915085208] , [ 1188532800000 , 239.89428956243] , [ 1191124800000 , 260.47781917715] , [ 1193803200000 , 276.39457482225] , [ 1196398800000 , 258.66530682672] , [ 1199077200000 , 250.98846121893] , [ 1201755600000 , 226.89902618127] , [ 1204261200000 , 227.29009273807] , [ 1206936000000 , 218.66476654350] , [ 1209528000000 , 232.46605902918] , [ 1212206400000 , 253.25667081117] , [ 1214798400000 , 235.82505363925] , [ 1217476800000 , 229.70112774254] , [ 1220155200000 , 225.18472705952] , [ 1222747200000 , 189.13661746552] , [ 1225425600000 , 149.46533007301] , [ 1228021200000 , 131.00340772114] , [ 1230699600000 , 135.18341728866] , [ 1233378000000 , 109.15296887173] , [ 1235797200000 , 84.614772549760] , [ 1238472000000 , 100.60810015326] , [ 1241064000000 , 141.50134895610] , [ 1243742400000 , 142.50405083675] , [ 1246334400000 , 139.81192372672] , [ 1249012800000 , 177.78205544583] , [ 1251691200000 , 194.73691933074] , [ 1254283200000 , 209.00838460225] , [ 1256961600000 , 198.19855877420] , [ 1259557200000 , 222.37102417812] , [ 1262235600000 , 234.24581081250] , [ 1264914000000 , 228.26087689346] , [ 1267333200000 , 248.81895126250] , [ 1270008000000 , 270.57301075186] , [ 1272600000000 , 292.64604322550] , [ 1275278400000 , 265.94088520518] , [ 1277870400000 , 237.82887467569] , [ 1280548800000 , 265.55973314204] , [ 1283227200000 , 248.30877330928] , [ 1285819200000 , 278.14870066912] , [ 1288497600000 , 292.69260960288] , [ 1291093200000 , 300.84263809599] , [ 1293771600000 , 326.17253914628] , [ 1296450000000 , 337.69335966505] , [ 1298869200000 , 339.73260965121] , [ 1301544000000 , 346.87865120765] , [ 1304136000000 , 347.92991526628] , [ 1306814400000 , 342.04627502669] , [ 1309406400000 , 333.45386231233] , [ 1312084800000 , 323.15034181243] , [ 1314763200000 , 295.66126882331] , [ 1317355200000 , 251.48014579253] , [ 1320033600000 , 295.15424257905] , [ 1322629200000 , 294.54766764397] , [ 1325307600000 , 295.72906119051] , [ 1327986000000 , 325.73351347613] , [ 1330491600000 , 340.16106061186] , [ 1333166400000 , 345.15514071490] , [ 1335758400000 , 337.10259395679] , [ 1338436800000 , 318.68216333837] , [ 1341028800000 , 317.03683945246] , [ 1343707200000 , 318.53549659997] , [ 1346385600000 , 332.85381464104] , [ 1348977600000 , 337.36534373477] , [ 1351656000000 , 350.27872156161] , [ 1354251600000 , 349.45128876100]] |
368 | , | 377 | , |
369 | mean: 250 | 378 | mean: 250 |
370 | }]; | 379 | }]; |
371 | //console.log("--datahfp---",$scope.datahfp); | 380 | //console.log("--datahfp---",$scope.datahfp); |
372 | 381 | ||
373 | 382 | ||
374 | /*Date Range Filter for Monthly fuel Sales*/ | 383 | /*Date Range Filter for Monthly fuel Sales*/ |
375 | $scope.submitDate = function(){ | 384 | $scope.submitDate = function(){ |
376 | 385 | ||
377 | if ($scope.drf.fromDate === undefined) { | 386 | if ($scope.drf.fromDate === undefined) { |
378 | 387 | ||
379 | // console.log("==frmdate====",$scope.drf.fromDate); | 388 | // console.log("==frmdate====",$scope.drf.fromDate); |
380 | //console.log("==toDate====",$scope.drf.toDate); | 389 | //console.log("==toDate====",$scope.drf.toDate); |
381 | $scope.fillForm = true; | 390 | $scope.fillForm = true; |
382 | } | 391 | } |
383 | else if($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate ===''){ | 392 | else if($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate ===''){ |
384 | $scope.fillForm = false; | 393 | $scope.fillForm = false; |
385 | var today= new Date(); | 394 | var today= new Date(); |
386 | var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); | 395 | var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); |
387 | //from date format | 396 | //from date format |
388 | $scope.dat1 = $scope.drf.fromDate; | 397 | $scope.dat1 = $scope.drf.fromDate; |
389 | $scope.fd1 = $scope.dat1.split("/").reverse(); | 398 | $scope.fd1 = $scope.dat1.split("/").reverse(); |
390 | $scope.tmp = $scope.fd1[2]; | 399 | $scope.tmp = $scope.fd1[2]; |
391 | $scope.fd1[2] = $scope.fd1[1]; | 400 | $scope.fd1[2] = $scope.fd1[1]; |
392 | $scope.fd1[1] = $scope.tmp; | 401 | $scope.fd1[1] = $scope.tmp; |
393 | $scope.fd = $scope.fd1.join("-"); | 402 | $scope.fd = $scope.fd1.join("-"); |
394 | // console.log("===fd====",$scope.fd); | 403 | // console.log("===fd====",$scope.fd); |
395 | //console.log("----td curr---",DefaultToDate); | 404 | //console.log("----td curr---",DefaultToDate); |
396 | analyticsService.getDRFChart($scope.fd,DefaultToDate).then(function(result) { | 405 | analyticsService.getDRFChart($scope.fd,DefaultToDate).then(function(result) { |
397 | //console.log("==date received==",$scope.fd); | 406 | //console.log("==date received==",$scope.fd); |
398 | //console.log("----to date receivedcurrent---",DefaultToDate) | 407 | //console.log("----to date receivedcurrent---",DefaultToDate) |
399 | $scope.datamfs = result; | 408 | $scope.datamfs = result; |
400 | }) | 409 | }) |
401 | 410 | ||
402 | 411 | ||
403 | } else if($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined ){ | 412 | } else if($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined ){ |
404 | $scope.fillForm = false; | 413 | $scope.fillForm = false; |
405 | //from date format | 414 | //from date format |
406 | $scope.dat1 = $scope.drf.fromDate; | 415 | $scope.dat1 = $scope.drf.fromDate; |
407 | $scope.fd1 = $scope.dat1.split("/").reverse(); | 416 | $scope.fd1 = $scope.dat1.split("/").reverse(); |
408 | $scope.tmp = $scope.fd1[2]; | 417 | $scope.tmp = $scope.fd1[2]; |
409 | $scope.fd1[2] = $scope.fd1[1]; | 418 | $scope.fd1[2] = $scope.fd1[1]; |
410 | $scope.fd1[1] = $scope.tmp; | 419 | $scope.fd1[1] = $scope.tmp; |
411 | $scope.fd = $scope.fd1.join("-"); | 420 | $scope.fd = $scope.fd1.join("-"); |
412 | //to date format | 421 | //to date format |
413 | $scope.dat2 = $scope.drf.toDate; | 422 | $scope.dat2 = $scope.drf.toDate; |
414 | $scope.td1 = $scope.dat2.split("/").reverse(); | 423 | $scope.td1 = $scope.dat2.split("/").reverse(); |
415 | $scope.tmp1 = $scope.td1[2]; | 424 | $scope.tmp1 = $scope.td1[2]; |
416 | $scope.td1[2] = $scope.td1[1]; | 425 | $scope.td1[2] = $scope.td1[1]; |
417 | $scope.td1[1] = $scope.tmp1; | 426 | $scope.td1[1] = $scope.tmp1; |
418 | $scope.td = $scope.td1.join("-"); | 427 | $scope.td = $scope.td1.join("-"); |
419 | 428 | ||
420 | analyticsService.getDRFChart($scope.fd,$scope.td).then(function(result) { | 429 | analyticsService.getDRFChart($scope.fd,$scope.td).then(function(result) { |
421 | // console.log("==date received==",$scope.fd); | 430 | // console.log("==date received==",$scope.fd); |
422 | //console.log("----to date received---",$scope.td) | 431 | //console.log("----to date received---",$scope.td) |
423 | $scope.datamfs = result; | 432 | $scope.datamfs = result; |
424 | }) | 433 | }) |
425 | 434 | ||
426 | }else | 435 | }else |
427 | { | 436 | { |
428 | $scope.fillForm = true; | 437 | $scope.fillForm = true; |
429 | } | 438 | } |
430 | 439 | ||
431 | 440 | ||
432 | } | 441 | } |
433 | 442 | ||
434 | /*Date Range Filter for Historic fuel Price*/ | 443 | /*Date Range Filter for Historic fuel Price*/ |
435 | $scope.submitDateHfp = function(){ | 444 | $scope.submitDateHfp = function(){ |
436 | 445 | ||
437 | if ($scope.hfp.fromDate === undefined) { | 446 | if ($scope.hfp.fromDate === undefined) { |
438 | 447 | ||
439 | // console.log("==frmdate====",$scope.drf.fromDate); | 448 | // console.log("==frmdate====",$scope.drf.fromDate); |
440 | //console.log("==toDate====",$scope.drf.toDate); | 449 | //console.log("==toDate====",$scope.drf.toDate); |
441 | $scope.fillForm = true; | 450 | $scope.fillForm = true; |
442 | } | 451 | } |
443 | else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate ===''){ | 452 | else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate ===''){ |
444 | $scope.fillForm = false; | 453 | $scope.fillForm = false; |
445 | var today= new Date(); | 454 | var today= new Date(); |
446 | var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); | 455 | var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); |
447 | //from date format | 456 | //from date format |
448 | $scope.dat1 = $scope.hfp.fromDate; | 457 | $scope.dat1 = $scope.hfp.fromDate; |
449 | $scope.fd1 = $scope.dat1.split("/").reverse(); | 458 | $scope.fd1 = $scope.dat1.split("/").reverse(); |
450 | $scope.tmp = $scope.fd1[2]; | 459 | $scope.tmp = $scope.fd1[2]; |
451 | $scope.fd1[2] = $scope.fd1[1]; | 460 | $scope.fd1[2] = $scope.fd1[1]; |
452 | $scope.fd1[1] = $scope.tmp; | 461 | $scope.fd1[1] = $scope.tmp; |
453 | $scope.fd = $scope.fd1.join("-"); | 462 | $scope.fd = $scope.fd1.join("-"); |
454 | // console.log("===fd====",$scope.fd); | 463 | // console.log("===fd====",$scope.fd); |
455 | //console.log("----td curr---",DefaultToDate); | 464 | //console.log("----td curr---",DefaultToDate); |
456 | analyticsService.getDRFHfpChart($scope.fd,DefaultToDate).then(function(result) { | 465 | analyticsService.getDRFHfpChart($scope.fd,DefaultToDate).then(function(result) { |
457 | //console.log("==date received==",$scope.fd); | 466 | //console.log("==date received==",$scope.fd); |
458 | //console.log("----to date receivedcurrent---",DefaultToDate) | 467 | //console.log("----to date receivedcurrent---",DefaultToDate) |
459 | $scope.datahfp = result; | 468 | $scope.datahfp = result; |
460 | }) | 469 | }) |
461 | 470 | ||
462 | 471 | ||
463 | } else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined ){ | 472 | } else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined ){ |
464 | $scope.fillForm = false; | 473 | $scope.fillForm = false; |
465 | //from date format | 474 | //from date format |
466 | $scope.dat1 = $scope.hfp.fromDate; | 475 | $scope.dat1 = $scope.hfp.fromDate; |
467 | $scope.fd1 = $scope.dat1.split("/").reverse(); | 476 | $scope.fd1 = $scope.dat1.split("/").reverse(); |
468 | $scope.tmp = $scope.fd1[2]; | 477 | $scope.tmp = $scope.fd1[2]; |
469 | $scope.fd1[2] = $scope.fd1[1]; | 478 | $scope.fd1[2] = $scope.fd1[1]; |
470 | $scope.fd1[1] = $scope.tmp; | 479 | $scope.fd1[1] = $scope.tmp; |
471 | $scope.fd = $scope.fd1.join("-"); | 480 | $scope.fd = $scope.fd1.join("-"); |
472 | //to date format | 481 | //to date format |
473 | $scope.dat2 = $scope.hfp.toDate; | 482 | $scope.dat2 = $scope.hfp.toDate; |
474 | $scope.td1 = $scope.dat2.split("/").reverse(); | 483 | $scope.td1 = $scope.dat2.split("/").reverse(); |
475 | $scope.tmp1 = $scope.td1[2]; | 484 | $scope.tmp1 = $scope.td1[2]; |
476 | $scope.td1[2] = $scope.td1[1]; | 485 | $scope.td1[2] = $scope.td1[1]; |
477 | $scope.td1[1] = $scope.tmp1; | 486 | $scope.td1[1] = $scope.tmp1; |
478 | $scope.td = $scope.td1.join("-"); | 487 | $scope.td = $scope.td1.join("-"); |
479 | 488 | ||
480 | analyticsService.getDRFHfpChart($scope.fd,$scope.td).then(function(result) { | 489 | analyticsService.getDRFHfpChart($scope.fd,$scope.td).then(function(result) { |
481 | // console.log("==date received==",$scope.fd); | 490 | // console.log("==date received==",$scope.fd); |
482 | //console.log("----to date received---",$scope.td) | 491 | //console.log("----to date received---",$scope.td) |
483 | $scope.datahfp = result; | 492 | $scope.datahfp = result; |
484 | }) | 493 | }) |
485 | 494 | ||
486 | }else | 495 | }else |
487 | { | 496 | { |
488 | $scope.fillForm = true; | 497 | $scope.fillForm = true; |
489 | } | 498 | } |
490 | 499 | ||
491 | 500 | ||
492 | } | 501 | } |
493 | 502 | ||
494 | /*Date Range Filter for Customer Sources*/ | 503 | /*Date Range Filter for Customer Sources*/ |
495 | $scope.submitDateCs = function(){ | 504 | $scope.submitDateCs = function(){ |
505 | console.log("==fromdate===",$scope.cs.fromDate) | ||
506 | console.log("====todate=====",$scope.cs.toDate) | ||
496 | 507 | ||
497 | if ($scope.cs.fromDate === undefined) { | 508 | if ($scope.cs.fromDate === undefined) { |
498 | 509 | ||
499 | // console.log("==frmdate====",$scope.drf.fromDate); | ||
500 | //console.log("==toDate====",$scope.drf.toDate); | ||
501 | $scope.fillForm = true; | 510 | $scope.fillForm = true; |
502 | } | 511 | } |
503 | else if($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate ===''){ | 512 | else if($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate ===''){ |
504 | $scope.fillForm = false; | 513 | $scope.fillForm = false; |
505 | var today= new Date(); | 514 | var today= new Date(); |
506 | var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); | 515 | var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); |
507 | //from date format | 516 | //from date format |
508 | $scope.dat1 = $scope.cs.fromDate; | 517 | $scope.dat1 = $scope.cs.fromDate; |
509 | $scope.fd1 = $scope.dat1.split("/").reverse(); | 518 | $scope.fd1 = $scope.dat1.split("/").reverse(); |
510 | $scope.tmp = $scope.fd1[2]; | 519 | $scope.tmp = $scope.fd1[2]; |
511 | $scope.fd1[2] = $scope.fd1[1]; | 520 | $scope.fd1[2] = $scope.fd1[1]; |
512 | $scope.fd1[1] = $scope.tmp; | 521 | $scope.fd1[1] = $scope.tmp; |
513 | $scope.fd = $scope.fd1.join("-"); | 522 | $scope.fd = $scope.fd1.join("-"); |
514 | // console.log("===fd====",$scope.fd); | ||
515 | //console.log("----td curr---",DefaultToDate); | ||
516 | analyticsService.getDRFCSChart($scope.fd,DefaultToDate).then(function(result) { | 523 | analyticsService.getDRFCSChart($scope.fd,DefaultToDate).then(function(result) { |
517 | //console.log("==date received==",$scope.fd); | 524 | $scope.csValues = result; |
518 | //console.log("----to date receivedcurrent---",DefaultToDate) | 525 | $scope.optionscs = { |
519 | $scope.datacs = result; | 526 | chart: { |
527 | type: 'pieChart', | ||
528 | height: 500, | ||
529 | // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], | ||
530 | x: function(d){return d.key;}, | ||
531 | y: function(d){return d.y;}, | ||
532 | showLabels: false, | ||
533 | segmentShowStroke : false, | ||
534 | animationSteps : 20, | ||
535 | animationEasing : "linear", | ||
536 | animateScale : true, | ||
537 | duration: 500, | ||
538 | labelThreshold: 0.01, | ||
539 | labelSunbeamLayout: true, | ||
540 | legend: { | ||
541 | margin: { | ||
542 | top: 5, | ||
543 | right: 35, | ||
544 | bottom: 5, | ||
545 | left: 0 | ||
546 | } | ||
547 | } | ||
548 | } | ||
549 | }; | ||
550 | $scope.datacs = $scope.csValues; | ||
520 | }) | 551 | }) |
521 | 552 | ||
522 | 553 | ||
523 | } else if($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined ){ | 554 | } else if($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined ){ |
524 | $scope.fillForm = false; | 555 | $scope.fillForm = false; |
525 | //from date format | 556 | //from date format |
526 | $scope.dat1 = $scope.cs.fromDate; | 557 | $scope.dat1 = $scope.cs.fromDate; |
527 | $scope.fd1 = $scope.dat1.split("/").reverse(); | 558 | $scope.fd1 = $scope.dat1.split("/").reverse(); |
528 | $scope.tmp = $scope.fd1[2]; | 559 | $scope.tmp = $scope.fd1[2]; |
529 | $scope.fd1[2] = $scope.fd1[1]; | 560 | $scope.fd1[2] = $scope.fd1[1]; |
530 | $scope.fd1[1] = $scope.tmp; | 561 | $scope.fd1[1] = $scope.tmp; |
531 | $scope.fd = $scope.fd1.join("-"); | 562 | $scope.fd = $scope.fd1.join("-"); |
532 | //to date format | 563 | //to date format |
533 | $scope.dat2 = $scope.cs.toDate; | 564 | $scope.dat2 = $scope.cs.toDate; |
534 | $scope.td1 = $scope.dat2.split("/").reverse(); | 565 | $scope.td1 = $scope.dat2.split("/").reverse(); |
535 | $scope.tmp1 = $scope.td1[2]; | 566 | $scope.tmp1 = $scope.td1[2]; |
536 | $scope.td1[2] = $scope.td1[1]; | 567 | $scope.td1[2] = $scope.td1[1]; |
537 | $scope.td1[1] = $scope.tmp1; | 568 | $scope.td1[1] = $scope.tmp1; |
538 | $scope.td = $scope.td1.join("-"); | 569 | $scope.td = $scope.td1.join("-"); |
539 | 570 | ||
540 | analyticsService.getDRFCSChart($scope.fd,$scope.td).then(function(result) { | 571 | analyticsService.getDRFCSChart($scope.fd,$scope.td).then(function(result) { |
541 | // console.log("==date received==",$scope.fd); | 572 | $scope.csValues = result; |
542 | //console.log("----to date received---",$scope.td) | 573 | $scope.optionscs = { |
543 | $scope.datacs = result; | 574 | chart: { |
575 | type: 'pieChart', | ||
576 | height: 500, | ||
577 | // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], | ||
578 | x: function(d){return d.key;}, | ||
579 | y: function(d){return d.y;}, | ||
580 | showLabels: false, | ||
581 | segmentShowStroke : false, | ||
582 | animationSteps : 20, | ||
583 | animationEasing : "linear", | ||
584 | animateScale : true, | ||
585 | duration: 500, | ||
586 | labelThreshold: 0.01, | ||
587 | labelSunbeamLayout: true, | ||
588 | legend: { | ||
589 | margin: { | ||
590 | top: 5, | ||
591 | right: 35, | ||
592 | bottom: 5, | ||
593 | left: 0 | ||
594 | } | ||
595 | } | ||
596 | } | ||
597 | }; | ||
598 | $scope.datacs = $scope.csValues; | ||
544 | }) | 599 | }) |
545 | 600 | ||
546 | }else | 601 | }else |
547 | { | 602 | { |
548 | $scope.fillForm = true; | 603 | $scope.fillForm = true; |
549 | } | 604 | } |
550 | 605 | ||
551 | 606 | ||
552 | } | 607 | } |
553 | 608 | ||
554 | 609 | ||
555 | 610 |
app/partials/analytics/analytics.service.js
1 | (function(){ | 1 | (function(){ |
2 | 'use strict'; | 2 | 'use strict'; |
3 | angular.module('acufuel') | 3 | angular.module('acufuel') |
4 | .service('analyticsService', ['$q', '$http', 'BASE_URL',analyticsService]); | 4 | .service('analyticsService', ['$q', '$http', 'BASE_URL',analyticsService]); |
5 | 5 | ||
6 | function analyticsService($q, $http, BASE_URL) { | 6 | function analyticsService($q, $http, BASE_URL) { |
7 | var temp = {}; | 7 | var temp = {}; |
8 | 8 | ||
9 | 9 | ||
10 | this.getMFS = function(){ | 10 | this.getMFS = function(){ |
11 | var deferred = $q.defer(); | 11 | var deferred = $q.defer(); |
12 | $http({ | 12 | $http({ |
13 | method : 'GET', | 13 | method : 'GET', |
14 | // url : BASE_URL.url +'/fuelOrder/export/mfs' | 14 | // url : BASE_URL.url +'/fuelOrder/export/mfs' |
15 | url : BASE_URL.url + '/fuelOrder/analytics' | 15 | url : BASE_URL.url + '/fuelOrder/analytics' |
16 | }) | 16 | }) |
17 | .then(function (result){ | 17 | .then(function (result){ |
18 | deferred.resolve(result.data); | 18 | deferred.resolve(result.data); |
19 | },function (result){ | 19 | },function (result){ |
20 | console.log(result) | 20 | console.log(result) |
21 | deferred.resolve(result.data); | 21 | deferred.resolve(result.data); |
22 | }) | 22 | }) |
23 | return deferred.promise; | 23 | return deferred.promise; |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | this.getCS = function(){ | 28 | this.getCS = function(){ |
29 | var deferred = $q.defer(); | 29 | var deferred = $q.defer(); |
30 | $http({ | 30 | $http({ |
31 | method : 'GET', | 31 | method : 'GET', |
32 | url : BASE_URL.url +'/user/sources' | 32 | url : BASE_URL.url +'/user/sources' |
33 | }) | 33 | }) |
34 | .then(function (result){ | 34 | .then(function (result){ |
35 | deferred.resolve(result.data); | 35 | deferred.resolve(result.data); |
36 | },function (result){ | 36 | },function (result){ |
37 | console.log(result) | 37 | console.log(result) |
38 | deferred.resolve(result.data); | 38 | deferred.resolve(result.data); |
39 | }) | 39 | }) |
40 | return deferred.promise; | 40 | return deferred.promise; |
41 | } | 41 | } |
42 | 42 | ||
43 | /*---date filter for Monthly fuel sales chart - dates are sending to the api */ | 43 | /*---date filter for Monthly fuel sales chart - dates are sending to the api */ |
44 | this.getDRFChart = function(fd,td){ | 44 | this.getDRFChart = function(fd,td){ |
45 | var deferred = $q.defer(); | 45 | var deferred = $q.defer(); |
46 | $http({ | 46 | $http({ |
47 | method : 'GET', | 47 | method : 'GET', |
48 | url : BASE_URL.url + '/fuelOrder/filterchart?fromDate='+fd+'&toDate='+td+'' | 48 | url : BASE_URL.url + '/fuelOrder/filterchart?fromDate='+fd+'&toDate='+td+'' |
49 | }) | 49 | }) |
50 | .then(function (result){ | 50 | .then(function (result){ |
51 | deferred.resolve(result.data); | 51 | deferred.resolve(result.data); |
52 | },function (result){ | 52 | },function (result){ |
53 | console.log(result) | 53 | console.log(result) |
54 | deferred.resolve(result.data); | 54 | deferred.resolve(result.data); |
55 | }) | 55 | }) |
56 | return deferred.promise; | 56 | return deferred.promise; |
57 | } | 57 | } |
58 | 58 | ||
59 | /*---date filter for Historic Fuel price --- DRF--Date Range Filter */ | 59 | /*---date filter for Historic Fuel price --- DRF--Date Range Filter */ |
60 | this.getDRFHfpChart = function(fd,td){ | 60 | this.getDRFHfpChart = function(fd,td){ |
61 | var deferred = $q.defer(); | 61 | var deferred = $q.defer(); |
62 | $http({ | 62 | $http({ |
63 | method : 'GET', | 63 | method : 'GET', |
64 | url : BASE_URL.url + '/fuelOrder/hfp/filterchart?fromDate='+fd+'&toDate='+td+'' | 64 | url : BASE_URL.url + '/fuelOrder/hfp/filterchart?fromDate='+fd+'&toDate='+td+'' |
65 | }) | 65 | }) |
66 | .then(function (result){ | 66 | .then(function (result){ |
67 | deferred.resolve(result.data); | 67 | deferred.resolve(result.data); |
68 | },function (result){ | 68 | },function (result){ |
69 | console.log(result) | 69 | console.log(result) |
70 | deferred.resolve(result.data); | 70 | deferred.resolve(result.data); |
71 | }) | 71 | }) |
72 | return deferred.promise; | 72 | return deferred.promise; |
73 | } | 73 | } |
74 | 74 | ||
75 | /*---date filter for Customer Sources --- DRF--Date Range Filter */ | 75 | /*---date filter for Customer Sources --- DRF--Date Range Filter */ |
76 | this.getDRFCSChart = function(fd,td){ | 76 | this.getDRFCSChart = function(fd,td){ |
77 | var deferred = $q.defer(); | 77 | var deferred = $q.defer(); |
78 | $http({ | 78 | $http({ |
79 | method : 'GET', | 79 | method : 'GET', |
80 | url : BASE_URL.url + '/fuelOrder/cs/filterchart?fromDate='+fd+'&toDate='+td+'' | 80 | url : BASE_URL.url + '/user/cs/filterchart?fromDate='+fd+'&toDate='+td+'' |
81 | }) | 81 | }) |
82 | .then(function (result){ | 82 | .then(function (result){ |
83 | deferred.resolve(result.data); | 83 | deferred.resolve(result.data); |
84 | },function (result){ | 84 | },function (result){ |
85 | console.log(result) | 85 | console.log(result) |
86 | deferred.resolve(result.data); | 86 | deferred.resolve(result.data); |
87 | }) | 87 | }) |
88 | return deferred.promise; | 88 | return deferred.promise; |
89 | } | 89 | } |
90 | 90 | ||
91 | } | 91 | } |
92 | 92 | ||
93 | })(); | 93 | })(); |