Blame view

app/partials/analytics/analytics.controller.js 25.8 KB
feacde5ff   Rishav   setup acuefuel in...
1
  'use strict';
d20181a2e   Anchit Jindal   fixed bugs
2
3
  angular.module('acufuel')
      .controller('analyticsController', ['$scope', 'analyticsService', function($scope, analyticsService) {
7b21cec8f   Kuldeep Arora   analytical region...
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  
           
          $scope.getAllRegionalPap = function() {
              $scope.flag=true;
              $scope.stateList = [{region:'Alabama',code:'AL'},{region:'Alaska',code:'AK'},{region:'Arizona',code:'AZ'},{region:'Arkansas',code:'AR'},
                  {region:'California',code:'CA' },{region:'Colorado',code:'CO'},{region:'Connecticut',code:'CT'},{region:'Delaware',code:'DE'},
                  {region:'Florida' ,code:'FL'},{region:'Georgia' ,code:'GA'},{region:'Hawaii' ,code:'HI'},{region:'Idaho' ,code:'ID'},
                  {region:'Illinois',code:'IL'},{region:'Indiana' ,code:'IN'},{region:'Iowa' ,code:'IA'},{region:'Kansas' ,code:'KS'},
                  {region:'Kentucky' ,code:'KY'},{region:'Louisiana' ,code:'LA'},{region:'Maine' ,code:'ME'},{region:'Maryland' ,code:'MD'},
                  {region:'Massachusetts' ,code:'MA'},{region:'Michigan' ,code:'MI'},{region:'Minnesota' ,code:'MN'},
                  {region:'Mississippi' ,code:'MS'},{region:'Missouri' ,code:'MO'},{region:'Montana',code:'MT'},{region:'Nebraska' ,code:'NE'},
                  {region:'Nevada' ,code:'NV'},{region:'New Hampshire' ,code:'NH'},{region:'New Jersey' ,code:'NJ'},{region:'New Mexico' ,code:'NM'},
                  {region:'New York' ,code:'NY'},{region:'North Carolina' ,code:'NC'},{region:'North Dakota' ,code:'ND'},{region:'Ohio' ,code:'OH'},
                  {region:'Oklahoma' ,code:'OK'},{region:'Oregon' ,code:'OR'},{region:'Pennsylvania',code:'PA'},{region:'Rhode Island' ,code:'RI'},
                  {region:'South Carolina' ,code:'SC'},{region:'South Dakota' ,code:'SD'},{region:'Tennessee' ,code:'TN'},{region:'Texas' ,code:'TX'},
                  {region:'Utah' ,code:'UT'},{region:'Vermont' ,code:'VT'},{region:'Virginia' ,code:'VA'},{region:'Washington' ,code:'WA'},
                  {region:'West Virginia' ,code:'WV'},{region:'Wisconsin' ,code:'WI'},{region:'Wyoming',code:'WY'}]
             
              analyticsService.getAllRPP().then(function(result) {
                      for (var i = 0; i < $scope.stateList.length; i++) {
                          for (var j = 0; j<result.length; j++){
                              if ($scope.stateList[i].region === result[j].region) {
                                  result[j].code = $scope.stateList[i].code; 
938f3037d   Kuldeep Arora   decimal fixed ana...
27
                                  result[j].averagePAP = result[j].averagePAP.toFixed(2);
7b21cec8f   Kuldeep Arora   analytical region...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
                              }
                          }                   
                      }
                       $scope.flag=false;
                      // Instantiate the map
                      Highcharts.mapChart('regional-pap', {
  
                          chart: {
                              map: 'countries/us/us-all',
                              borderWidth: 1,
                          },
  
                          title: {
                              text: 'Regional PAP'
                          },
  
                          exporting: {
                              sourceWidth: 600,
                              sourceHeight: 500
                          },
  
                          legend: {
                              layout: 'vertical',
                              borderWidth: 0,
                              backgroundColor: 'rgba(255,255,255,0.85)',
                              floating: true,
                              width:'12px',
                              height:'200px',
                              verticalAlign: 'bottom',
                              y: 0,
                              x: -230,
                          },
  
                          mapNavigation: {
                              enabled: true
                          },
  
                          /* colorAxis: {
                               min: 1,
                               type: 'logarithmic',
                               minColor: '#2b908f',
                               maxColor: '#000022',
                               stops: [
                                   [0, '#EFEFFF'],
                                   [5, '#f45b5b'],
                                   [10, 'rgb(117,0,0)']
                               ]
                           },*/
  
                          series: [{
                              animation: {
                                  duration: 1000
                              },
                              data: result,
                              joinBy: ['postal-code', 'code'],
                              dataLabels: {
                                  enabled: true,
                                  color: '#FFFFFF',
                                  format: '{point.code}'
                              },
                              name: 'Data' ,
                              tooltip: {
                                  pointFormat: '{point.region} : {point.averagePAP}'
                              },
                          }]
                      });
              })
          }
  
          $scope.getAllRegionalPap();
          
          /*$(document).ready(function() {
d20181a2e   Anchit Jindal   fixed bugs
100
              $(function() {
d20181a2e   Anchit Jindal   fixed bugs
101
                  jQuery('#map').vectorMap({
1b71872b2   Kuldeep Arora   email and code be...
102
103
                      map: 'us_lcc',
                      backgroundColor: '#ffce99',
d20181a2e   Anchit Jindal   fixed bugs
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
                      color: '#dfdfdd',
                      hoverOpacity: 0,
                      selectedColor: '#5f8b98',
                      hoverColor: '#5f8b98',
                      enableZoom: true,
                      showTooltip: true,
                      scaleColors: ['#dfdfdd'],
                      //values: sample_data
                      onRegionClick: function(event, code) {
                          var map = $('#map').vectorMap('get', 'mapObject');
                          var name = map.getRegionName(code);
                          getRegionPap(name);
                      },
                      normalizeFunction: 'polynomial'
                  });
d20181a2e   Anchit Jindal   fixed bugs
119
              });
7b21cec8f   Kuldeep Arora   analytical region...
120
          })*/
bd3a040f8   Kuldeep Arora   Regional Pap pric...
121

d20181a2e   Anchit Jindal   fixed bugs
122
123
124
          function getRegionPap(code) {
              $scope.showLoader = true;
              analyticsService.getRPP(code).then(function(result) {
f6e8207e4   Kuldeep Arora   charts
125
126
127
                  $scope.rppData = result;
                  $scope.showLoader = false;
                  $('#popup1').css('display', 'block');
d20181a2e   Anchit Jindal   fixed bugs
128
129
              })
          }
7b21cec8f   Kuldeep Arora   analytical region...
130

d20181a2e   Anchit Jindal   fixed bugs
131
          $scope.cancelStatus = function() {
bd3a040f8   Kuldeep Arora   Regional Pap pric...
132
              $('#popup1').css('display', 'none');
d20181a2e   Anchit Jindal   fixed bugs
133
134
135
136
137
          }
          $scope.ordersCost = 0;
          $scope.ordersCount = 0;
  
          $scope.orderCostAndCount = function() {
f6e8207e4   Kuldeep Arora   charts
138
139
              analyticsService.orderCostAndCount().then(function(result) {
                  $scope.ordersCost = result.cost;
d20181a2e   Anchit Jindal   fixed bugs
140
                  $scope.ordersCount = result.count;
f6e8207e4   Kuldeep Arora   charts
141
              })
d20181a2e   Anchit Jindal   fixed bugs
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
          }
  
          $scope.drf = {};
          $scope.hfp = {};
          $scope.cs = {};
          $scope.mfsValues = [];
          $scope.msfarray = [];
          $scope.getMFS = function() {
              //var makeId = makeId;
              analyticsService.getMFS().then(function(result) {
                  $scope.mfsValues = result;
                  $scope.optionsmfs = {
                      chart: {
                          type: 'multiBarChart',
                          height: 450,
                          margin: {
                              top: 45,
                              right: 20,
                              bottom: 45,
                              left: 45
                          },
                          clipEdge: true,
                          //staggerLabels: true,
                          duration: 500,
                          stacked: false,
                          color: ["#FEDFC3", "#990000", "#000099", "#009900"],
                          xAxis: {
                              axisLabel: 'Months',
                              showMaxMin: false,
                          },
                          yAxis: {
                              axisLabel: 'Orders',
                              axisLabelDistance: -20,
                              tickFormat: function(d) {
                                  return d3.format(',.1f')(d);
                              }
                          }
                      }
                  };
                  $scope.datamfs = $scope.mfsValues;
              })
          }
  
          $scope.orderCostAndCount();
          $scope.getMFS();
          $scope.csValues = [];
          $scope.getCS = function() {
              //var makeId = makeId;
              analyticsService.getCS().then(function(result) {
                  $scope.csValues = result;
                  $scope.optionscs = {
                      chart: {
                          type: 'pieChart',
                          height: 500,
                          // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
                          x: function(d) {
                              return d.key;
                          },
                          y: function(d) {
                              return d.y;
                          },
                          showLabels: false,
                          segmentShowStroke: false,
                          animationSteps: 20,
                          animationEasing: "linear",
                          animateScale: true,
                          duration: 500,
                          labelThreshold: 0.01,
                          labelSunbeamLayout: true,
                          legend: {
                              margin: {
                                  top: 5,
                                  right: 35,
                                  bottom: 5,
                                  left: 0
                              }
                          }
                      }
                  };
                  $scope.datacs = $scope.csValues;
              })
bd3a040f8   Kuldeep Arora   Regional Pap pric...
223
          }
d20181a2e   Anchit Jindal   fixed bugs
224
          $scope.getCS();
cefbd3ffa   Anchit Jindal   email related issues
225
226
227
228
229
230
          
         
          $scope.hfpValues = [];
          $scope.getHfpChartData = function() {
              //var makeId = makeId;
              analyticsService.gethfpChart().then(function(result) {
cefbd3ffa   Anchit Jindal   email related issues
231
                  $scope.hfpValues = result;
7b21cec8f   Kuldeep Arora   analytical region...
232
                  //console.log('---kd result--',$scope.hfpValues);
cefbd3ffa   Anchit Jindal   email related issues
233
                  
d20181a2e   Anchit Jindal   fixed bugs
234
          /*Historic Fuel Price */
cefbd3ffa   Anchit Jindal   email related issues
235
          
d20181a2e   Anchit Jindal   fixed bugs
236
          $scope.optionshfp = {
cefbd3ffa   Anchit Jindal   email related issues
237
238
239
240
                  chart: {
                      type: 'cumulativeLineChart',
                      height: 450,
                      margin: {
6c5a99488   Kuldeep Arora   analytics and fue...
241
                          top: 40,
cefbd3ffa   Anchit Jindal   email related issues
242
243
244
245
246
247
248
249
                          right: 20,
                          bottom: 50,
                          left: 65
                      },
                      x: function(d) {
                          return d[0];
                      },
                      y: function(d) {
de02ae986   Kuldeep Arora   minor
250
                          return d[1] / 100 ;
cefbd3ffa   Anchit Jindal   email related issues
251
252
253
254
                      },
                      average: function(d) {
                          return d.mean / 100;
                      },
d20181a2e   Anchit Jindal   fixed bugs
255

cefbd3ffa   Anchit Jindal   email related issues
256
257
258
259
                      color: ["#FEDFC3"],
                      duration: 300,
                      useInteractiveGuideline: true,
                      clipVoronoi: false,
d20181a2e   Anchit Jindal   fixed bugs
260

cefbd3ffa   Anchit Jindal   email related issues
261
                      xAxis: {
6c5a99488   Kuldeep Arora   analytics and fue...
262
263
                          axisLabel: '',
                                                     
cefbd3ffa   Anchit Jindal   email related issues
264
                          tickFormat: function(d) {
de02ae986   Kuldeep Arora   minor
265
266
                              return d3.time.format('%m/%d/%y')(new Date(d))
                             //return d3.time.format('%b \-%y')(new Date(d))   
cefbd3ffa   Anchit Jindal   email related issues
267
268
269
                          },
                          showMaxMin: false,
                          staggerLabels: true
d20181a2e   Anchit Jindal   fixed bugs
270
                      },
d20181a2e   Anchit Jindal   fixed bugs
271

cefbd3ffa   Anchit Jindal   email related issues
272
                      yAxis: {
6c5a99488   Kuldeep Arora   analytics and fue...
273
                          axisLabel: 'PaP/Retail Price',
cefbd3ffa   Anchit Jindal   email related issues
274
275
                          
                          tickFormat: function(d) {
6c5a99488   Kuldeep Arora   analytics and fue...
276
277
                              //return d3.format('')(d).toFixed(2);
                              return '$ '+d.toFixed(2)
cefbd3ffa   Anchit Jindal   email related issues
278
                          },
6c5a99488   Kuldeep Arora   analytics and fue...
279
                          axisLabelDistance: 5
cefbd3ffa   Anchit Jindal   email related issues
280
                      }
a9aef0b1c   Anchit Jindal   new changes imple...
281
                  }
cefbd3ffa   Anchit Jindal   email related issues
282
              };
6c5a99488   Kuldeep Arora   analytics and fue...
283
284
285
286
287
                  $scope.datahfp = [{
                      key: "Long",
                      values: $scope.hfpValues,
                      mean: 0
                  }];
6c5a99488   Kuldeep Arora   analytics and fue...
288
289
290
291
292
                  
              })
          }
          
          $scope.getHfpChartData();
d121d5539   Kuldeep Arora   UI Changes
293

d20181a2e   Anchit Jindal   fixed bugs
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
          /*Date Range Filter for Monthly fuel Sales*/
          $scope.submitDate = function() {
              if ($scope.drf.fromDate === undefined) {
                  $scope.fillForm = true;
              } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate === '') {
                  $scope.fillForm = false;
                  var today = new Date();
                  var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2);
                  //from date format                  
                  $scope.dat1 = $scope.drf.fromDate;
                  $scope.fd1 = $scope.dat1.split("/").reverse();
                  $scope.tmp = $scope.fd1[2];
                  $scope.fd1[2] = $scope.fd1[1];
                  $scope.fd1[1] = $scope.tmp;
                  $scope.fd = $scope.fd1.join("-");
                  analyticsService.getDRFChart($scope.fd, DefaultToDate).then(function(result) {
                      $scope.datamfs = [];
                      $scope.datamfs = result;
                  })
565570086   Kuldeep Arora   highcharts(MFS,CS...
313
                  
f6e8207e4   Kuldeep Arora   charts
314
315
316
317
                  analyticsService.orderCostAndCountByDate($scope.fd, DefaultToDate).then(function(result) {
                      $scope.ordersCost = result.cost;
                      $scope.ordersCount = result.count;
                  })
d20181a2e   Anchit Jindal   fixed bugs
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
              } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined) {
                  $scope.fillForm = false;
                  //from date format
                  $scope.dat1 = $scope.drf.fromDate;
                  $scope.fd1 = $scope.dat1.split("/").reverse();
                  $scope.tmp = $scope.fd1[2];
                  $scope.fd1[2] = $scope.fd1[1];
                  $scope.fd1[1] = $scope.tmp;
                  $scope.fd = $scope.fd1.join("-");
                  $scope.dat2 = $scope.drf.toDate;
                  $scope.td1 = $scope.dat2.split("/").reverse();
                  $scope.tmp1 = $scope.td1[2];
                  $scope.td1[2] = $scope.td1[1];
                  $scope.td1[1] = $scope.tmp1;
                  $scope.td = $scope.td1.join("-");
  
                  analyticsService.getDRFChart($scope.fd, $scope.td).then(function(result) {
                      $scope.datamfs = [];
                      $scope.datamfs = result;
                  })
565570086   Kuldeep Arora   highcharts(MFS,CS...
338
                  
d20181a2e   Anchit Jindal   fixed bugs
339
                  analyticsService.orderCostAndCountByDate($scope.fd, $scope.td).then(function(result) {
f6e8207e4   Kuldeep Arora   charts
340
341
342
                      $scope.ordersCost = result.cost;
                      $scope.ordersCount = result.count;
                  })
d20181a2e   Anchit Jindal   fixed bugs
343
344
345
  
              } else {
                  $scope.fillForm = true;
565570086   Kuldeep Arora   highcharts(MFS,CS...
346
              }
d20181a2e   Anchit Jindal   fixed bugs
347

565570086   Kuldeep Arora   highcharts(MFS,CS...
348
          }
d20181a2e   Anchit Jindal   fixed bugs
349
350
351
352
          /*Date Range Filter for Historic fuel Price*/
          $scope.submitDateHfp = function() {
  
              if ($scope.hfp.fromDate === undefined) {
d20181a2e   Anchit Jindal   fixed bugs
353
354
355
356
357
358
359
360
361
362
363
364
                  $scope.fillForm = true;
              } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate === '') {
                  $scope.fillForm = false;
                  var today = new Date();
                  var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2);
                  //from date format                  
                  $scope.dat1 = $scope.hfp.fromDate;
                  $scope.fd1 = $scope.dat1.split("/").reverse();
                  $scope.tmp = $scope.fd1[2];
                  $scope.fd1[2] = $scope.fd1[1];
                  $scope.fd1[1] = $scope.tmp;
                  $scope.fd = $scope.fd1.join("-");
d20181a2e   Anchit Jindal   fixed bugs
365
                  analyticsService.getDRFHfpChart($scope.fd, DefaultToDate).then(function(result) {
f6e8207e4   Kuldeep Arora   charts
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
                      $scope.hfpValues = result;
                       $scope.optionshfp = {
                              chart: {
                              type: 'cumulativeLineChart',
                              height: 450,
                              margin: {
                                  top: 40,
                                  right: 20,
                                  bottom: 50,
                                  left: 65
                              },
                              x: function(d) {
                                  return d[0];
                              },
                              y: function(d) {
de02ae986   Kuldeep Arora   minor
381
                                  return d[1]  / 100;
f6e8207e4   Kuldeep Arora   charts
382
383
384
385
386
387
388
389
390
391
392
393
394
395
                              },
                              average: function(d) {
                                  return d.mean / 100;
                              },
  
                              color: ["#FEDFC3"],
                              duration: 300,
                              useInteractiveGuideline: true,
                              clipVoronoi: false,
  
                              xAxis: {
                                  axisLabel: '',
                                                             
                                  tickFormat: function(d) {
de02ae986   Kuldeep Arora   minor
396
397
                                     return d3.time.format('%d / %m / %y')(new Date(d))
                                    // return d3.time.format('%b \-%y')(new Date(d))   
f6e8207e4   Kuldeep Arora   charts
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
                                  },
                                  showMaxMin: false,
                                  staggerLabels: true
                              },
  
                              yAxis: {
                                  axisLabel: 'PaP/Retail Price',
                                  
                                  tickFormat: function(d) {
                                      //return d3.format('')(d).toFixed(2);
                                      return '$ '+d.toFixed(2)
                                  },
                                  axisLabelDistance: 5
                              }
                          }
                      };
                          $scope.datahfp = [{
                              key: "Long",
                              values: $scope.hfpValues,
                              mean: 0
                          }];
d20181a2e   Anchit Jindal   fixed bugs
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
                  })
  
  
              } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined) {
                  $scope.fillForm = false;
                  //from date format
                  $scope.dat1 = $scope.hfp.fromDate;
                  $scope.fd1 = $scope.dat1.split("/").reverse();
                  $scope.tmp = $scope.fd1[2];
                  $scope.fd1[2] = $scope.fd1[1];
                  $scope.fd1[1] = $scope.tmp;
                  $scope.fd = $scope.fd1.join("-");
                  //to date format
                  $scope.dat2 = $scope.hfp.toDate;
                  $scope.td1 = $scope.dat2.split("/").reverse();
                  $scope.tmp1 = $scope.td1[2];
                  $scope.td1[2] = $scope.td1[1];
                  $scope.td1[1] = $scope.tmp1;
                  $scope.td = $scope.td1.join("-");
  
                  analyticsService.getDRFHfpChart($scope.fd, $scope.td).then(function(result) {
f6e8207e4   Kuldeep Arora   charts
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
                      $scope.hfpValues = result;
                           $scope.optionshfp = {
                                  chart: {
                                  type: 'cumulativeLineChart',
                                  height: 450,
                                  margin: {
                                      top: 40,
                                      right: 20,
                                      bottom: 50,
                                      left: 65
                                  },
                                  x: function(d) {
                                      return d[0];
                                  },
                                  y: function(d) {
de02ae986   Kuldeep Arora   minor
455
                                      return d[1] / 100 ;
f6e8207e4   Kuldeep Arora   charts
456
457
458
459
460
461
462
463
464
465
466
467
468
469
                                  },
                                  average: function(d) {
                                      return d.mean / 100;
                                  },
  
                                  color: ["#FEDFC3"],
                                  duration: 300,
                                  useInteractiveGuideline: true,
                                  clipVoronoi: false,
  
                                  xAxis: {
                                      axisLabel: '',
                                                                 
                                      tickFormat: function(d) {
de02ae986   Kuldeep Arora   minor
470
471
                                         return d3.time.format('%d / %m / %y')(new Date(d))
                                         //return d3.time.format('%b \-%y')(new Date(d))   
f6e8207e4   Kuldeep Arora   charts
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
                                      },
                                      showMaxMin: false,
                                      staggerLabels: true
                                  },
  
                                  yAxis: {
                                      axisLabel: 'PaP/Retail Price',
                                      
                                      tickFormat: function(d) {
                                          //return d3.format('')(d).toFixed(2);
                                          return '$ '+d.toFixed(2)
                                      },
                                      axisLabelDistance: 5
                                  }
                              }
                          };
                              $scope.datahfp = [{
                                  key: "Long",
                                  values:$scope.hfpValues,
                                  mean: 0
                              }];
d20181a2e   Anchit Jindal   fixed bugs
493
494
495
496
                  })
  
              } else {
                  $scope.fillForm = true;
75d1c3d9f   Kuldeep Arora   analytics DRF UI
497
              }
d20181a2e   Anchit Jindal   fixed bugs
498

75d1c3d9f   Kuldeep Arora   analytics DRF UI
499
          }
d20181a2e   Anchit Jindal   fixed bugs
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
          /*Date Range Filter for Customer Sources*/
          $scope.submitDateCs = function() {
              if ($scope.cs.fromDate === undefined) {
  
                  $scope.fillForm = true;
              } else if ($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate === '') {
                  $scope.fillForm = false;
                  var today = new Date();
                  var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2);
                  //from date format                  
                  $scope.dat1 = $scope.cs.fromDate;
                  $scope.fd1 = $scope.dat1.split("/").reverse();
                  $scope.tmp = $scope.fd1[2];
                  $scope.fd1[2] = $scope.fd1[1];
                  $scope.fd1[1] = $scope.tmp;
                  $scope.fd = $scope.fd1.join("-");
                  analyticsService.getDRFCSChart($scope.fd, DefaultToDate).then(function(result) {
                      $scope.csValues = result;
                      $scope.optionscs = {
                          chart: {
                              type: 'pieChart',
                              height: 500,
                              // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
                              x: function(d) {
                                  return d.key;
                              },
                              y: function(d) {
                                  return d.y;
                              },
                              showLabels: false,
                              segmentShowStroke: false,
                              animationSteps: 20,
                              animationEasing: "linear",
                              animateScale: true,
                              duration: 500,
                              labelThreshold: 0.01,
                              labelSunbeamLayout: true,
                              legend: {
                                  margin: {
                                      top: 5,
                                      right: 35,
                                      bottom: 5,
                                      left: 0
b944d384c   Kuldeep Arora   analytics UI
543
                                  }
d20181a2e   Anchit Jindal   fixed bugs
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
                              }
                          }
                      };
                      $scope.datacs = $scope.csValues;
                  })
  
  
              } else if ($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined) {
                  $scope.fillForm = false;
                  //from date format
                  $scope.dat1 = $scope.cs.fromDate;
                  $scope.fd1 = $scope.dat1.split("/").reverse();
                  $scope.tmp = $scope.fd1[2];
                  $scope.fd1[2] = $scope.fd1[1];
                  $scope.fd1[1] = $scope.tmp;
                  $scope.fd = $scope.fd1.join("-");
                  //to date format
                  $scope.dat2 = $scope.cs.toDate;
                  $scope.td1 = $scope.dat2.split("/").reverse();
                  $scope.tmp1 = $scope.td1[2];
                  $scope.td1[2] = $scope.td1[1];
                  $scope.td1[1] = $scope.tmp1;
                  $scope.td = $scope.td1.join("-");
  
                  analyticsService.getDRFCSChart($scope.fd, $scope.td).then(function(result) {
                      $scope.csValues = result;
                      $scope.optionscs = {
                          chart: {
                              type: 'pieChart',
                              height: 500,
                              // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
                              x: function(d) {
                                  return d.key;
                              },
                              y: function(d) {
                                  return d.y;
                              },
                              showLabels: false,
                              segmentShowStroke: false,
                              animationSteps: 20,
                              animationEasing: "linear",
                              animateScale: true,
                              duration: 500,
                              labelThreshold: 0.01,
                              labelSunbeamLayout: true,
                              legend: {
                                  margin: {
                                      top: 5,
                                      right: 35,
                                      bottom: 5,
                                      left: 0
b944d384c   Kuldeep Arora   analytics UI
595
                                  }
d20181a2e   Anchit Jindal   fixed bugs
596
597
598
599
600
601
602
603
                              }
                          }
                      };
                      $scope.datacs = $scope.csValues;
                  })
  
              } else {
                  $scope.fillForm = true;
75d1c3d9f   Kuldeep Arora   analytics DRF UI
604
              }
75d1c3d9f   Kuldeep Arora   analytics DRF UI
605

d20181a2e   Anchit Jindal   fixed bugs
606
          }
75d1c3d9f   Kuldeep Arora   analytics DRF UI
607

feacde5ff   Rishav   setup acuefuel in...
608

d20181a2e   Anchit Jindal   fixed bugs
609
      }]);