fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [16355]


From: nelson . guerra
Subject: [Fmsystem-commits] [16355]
Date: Tue, 21 Feb 2017 00:23:07 -0500 (EST)

Revision: 16355
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16355
Author:   nelson224
Date:     2017-02-21 00:23:07 -0500 (Tue, 21 Feb 2017)
Log Message:
-----------


Added Paths:
-----------
    branches/dev-syncromind-2/property/js/portico/tts.report.js

Copied: branches/dev-syncromind-2/property/js/portico/tts.report.js (from rev 
16331, branches/dev-syncromind-2/property/js/portico/tts.index.js)
===================================================================
--- branches/dev-syncromind-2/property/js/portico/tts.report.js                 
        (rev 0)
+++ branches/dev-syncromind-2/property/js/portico/tts.report.js 2017-02-21 
05:23:07 UTC (rev 16355)
@@ -0,0 +1,67 @@
+
+$(document).ready(function ()
+{
+       $('.processing').hide();
+       
+       var config = {
+               type: 'pie',
+               data: {
+                       datasets: [{
+                               data: [],
+                               backgroundColor: [],
+                               hoverBackgroundColor: []
+                       }],
+                       labels: []
+               },
+               options: {
+                       responsive: true
+               }
+       };
+
+       var ctx = document.getElementById("chart-area");
+       var myPieChart = new Chart(ctx, config);
+       
+       $('#btn_search').click( function()
+       {
+               var oArgs = {menuaction: 'property.uitts.get_data_report'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+               var data = {"start_date": $('#filter_start_date').val(), 
"end_date": $('#filter_end_date').val(), "type": $('#type').val()};
+
+               var labels = [];
+               var values = [];
+               var backgroundColor = [];
+               var hoverBackgroundColor = [];
+               var datasets = {};
+
+               $('.processing').show();
+               $.ajax({
+                       type: 'GET',
+                       url: requestUrl,
+                       dataType: 'json',
+                       data: data
+               }).always(function () {
+                       $('.processing').hide();
+               }).done(function (result) {
+                       $.each(result, function(key, value) {
+                               labels.push(value.label);
+                               values.push(value.count);
+                               backgroundColor.push(value.backgroundColor);
+                               
hoverBackgroundColor.push(value.hoverBackgroundColor);
+                       });
+
+                       datasets = {
+                               data: values,
+                               backgroundColor: backgroundColor,
+                               hoverBackgroundColor: hoverBackgroundColor
+                       }; 
+
+                       config.data.datasets = [datasets];
+                       config.data.labels = labels;
+
+                       myPieChart.update();
+               });             
+       });
+       
+       $("#btn_search").trigger( "click" );
+
+});




reply via email to

[Prev in Thread] Current Thread [Next in Thread]