Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16046 | Rev 16048 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 16046 Rev 16047
Línea 23... Línea 23...
23
jQuery( document ).ready(function( $ ) {
23
jQuery( document ).ready(function( $ ) {
Línea 24... Línea 24...
24
 
24
 
25
    var startDate   = moment().format('YYYY-MM-DD'); 
25
    var startDate   = moment().format('YYYY-MM-DD'); 
Línea 26... Línea -...
26
    var endDate     = moment().format('YYYY-MM-DD'); 
-
 
-
 
26
    var endDate     = moment().format('YYYY-MM-DD'); 
Línea 27... Línea 27...
27
 
27
 
28
   
-
 
29
 
-
 
30
    // draw empty chart
-
 
31
    
-
 
32
 
-
 
33
    $.fn.reload = function() {
-
 
34
        NProgress.start();
-
 
35
        $.ajax({
-
 
36
            'dataType'  : 'json',
-
 
37
            'accept'    : 'application/json',
-
 
38
            'method'    : 'get',
-
 
39
            'url'       : '$routeOverview',
-
 
40
            'data'      :  {
-
 
41
                'startDate' : startDate,
-
 
42
                'endDate' : endDate
-
 
43
            },
-
 
44
        }).done(function(response) {
-
 
45
             var ctxchartProgressByDay = document.getElementById("chartProgressByDay").getContext("2d");
-
 
46
            if(response['success']) {
-
 
47
                // chartProgressByDay.data.datasets[0].data = response['data']['added_on'];
-
 
48
                // chartProgressByDay.data.datasets[1].data = response['data']['total_by_day'];
28
    var ctxchartProgressByDay = document.getElementById("chartProgressByDay").getContext("2d");
49
                // chartProgressByDay.update();
29
 
50
                 //var ctxchartProgressByDay = document.getElementById("chartProgressByDay").getContext("2d");
30
    // draw empty chart
51
                var chartProgressByDay = new Chart(ctxchartProgressByDay, {
31
    var chartProgressByDay = new Chart(ctxchartProgressByDay, {
52
        type: 'bar',
32
        type: 'bar',
53
        data: {
33
        data: {
54
            labels: [],
34
            labels: [],
55
            datasets: [
35
            datasets: [
56
                {
36
                {
57
                	label : 'LABEL_CHART_HOW_ARE_YOU_FEEL',
37
                	label : 'LABEL_CHART_HOW_ARE_YOU_FEEL',
58
         			backgroundColor: '#E69090',
38
         			backgroundColor: '#E69090',
59
                    borderColor: '#E69090',
39
                    borderColor: '#E69090',
60
                    borderWidth: 1,
40
                    borderWidth: 1,
61
                    fill: false,
41
                    fill: false,
62
                    data : response['data']['added_on']
42
                    data : []
63
              	},
43
              	},
64
                {
44
                {
65
                	label : 'LABEL_CHART_CLIMATE_ON_YOUR_ORGANIZATION',
45
                	label : 'LABEL_CHART_CLIMATE_ON_YOUR_ORGANIZATION',
66
                    backgroundColor: '#66BBBB',
46
                    backgroundColor: '#66BBBB',
67
         			borderColor: '#66BBBB',
47
         			borderColor: '#66BBBB',
68
         			borderWidth: 1,
48
         			borderWidth: 1,
69
                    fill: false,
49
                    fill: false,
70
                    data : response['data']['total_by_day']
50
                    data : []
71
                },
51
                },
72
            ]
52
            ]
Línea 83... Línea 63...
83
                    }
63
                    }
84
                }]
64
                }]
85
            }
65
            }
86
        }
66
        }
87
    });
67
    });
-
 
68
 
-
 
69
    $.fn.reload = function() {
-
 
70
        NProgress.start();
-
 
71
        $.ajax({
-
 
72
            'dataType'  : 'json',
-
 
73
            'accept'    : 'application/json',
-
 
74
            'method'    : 'get',
-
 
75
            'url'       : '$routeOverview',
-
 
76
            'data'      :  {
-
 
77
                'startDate' : startDate,
-
 
78
                'endDate' : endDate
-
 
79
            },
-
 
80
        }).done(function(response) {
-
 
81
            if(response['success']) {
-
 
82
                var data = jsonfile.jsonarray.map(function(e) {
-
 
83
                    console.log(e.response['data']['added_on']) ;
-
 
84
                });
-
 
85
                chartProgressByDay.data.datasets[0].data = response['data']['added_on'];
-
 
86
                chartProgressByDay.data.datasets[1].data = response['data']['total_by_day'];
-
 
87
                chartProgressByDay.update();
88
                console.log(chartProgressByDay.data.datasets[0].data);
88
                console.log(chartProgressByDay.data.datasets[0].data);
89
            }else{
89
            }else{
90
                $.fn.showError(response['data']);
90
                $.fn.showError(response['data']);
91
            }
91
            }
92
        }).fail(function( jqXHR, textStatus, errorThrown) {
92
        }).fail(function( jqXHR, textStatus, errorThrown) {