community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1689283 - /comdev/projects.apache.org/site/js/projects.js
Date Sun, 05 Jul 2015 19:29:45 GMT
Author: hboutemy
Date: Sun Jul  5 19:29:45 2015
New Revision: 1689283

URL: http://svn.apache.org/r1689283
Log:
extracted podlings evolution code

Modified:
    comdev/projects.apache.org/site/js/projects.js

Modified: comdev/projects.apache.org/site/js/projects.js
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/js/projects.js?rev=1689283&r1=1689282&r2=1689283&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Sun Jul  5 19:29:45 2015
@@ -1016,42 +1016,7 @@ function renderFrontPage() {
         + "<p><small>*Infrastructure, Travel Assistance, Security Team, Legal
Affairs and Brand Management</small></p>";
 
     renderCommitteeEvolution();
-    
-    var earr = [];
-    for (i in evolution) {
-        if (i > 260) {
-            break;
-        }
-        var evo = evolution[i];
-        earr.push([evo.month, evo.new, evo.graduated, evo.retired, evo.current]);
-    }
-    //narr.sort(function(a,b) { return (b[1] - a[1]) });
-    var data = new google.visualization.DataTable();
-    data.addColumn('string', 'Month');
-    data.addColumn('number', "New podlings");
-    data.addColumn('number', "Graduated podlings");
-    data.addColumn('number', "Retired podlings");
-    data.addColumn('number', 'Current podlings');
-    data.addRows(earr.reverse());
-    
-    coptions = {
-        title: "Podling evolution",
-        isStacked: true,
-        height: 320,
-        width: 1160,
-        seriesType: "bars",
-        backgroundColor: 'transparent',
-        series: {3: {type: "line", targetAxisIndex: 1}},
-        vAxes:[
-              {title: 'Change in states'},
-              {title: 'Current number of podlings'}
-              ]
-    };
-    var div = document.createElement('div');
-    obj.appendChild(div);
-    chart = new google.visualization.ComboChart(div);
-    chart.draw(data, coptions);
-    
+    renderPodlingsEvolution();
     renderLanguageChart();
 }
 
@@ -1067,6 +1032,7 @@ function htmlListTooltip(date,name,value
 
 function renderCommitteeEvolution() {
     var evo = {}; // 'year-month' -> { established: [], retired: [] }
+    // init evo with empty content for the whole period
     var maxYear = new Date().getFullYear();
     for (var year = 1995; year <= maxYear; year++) {
         var maxMonth = (year < maxYear) ? 12 : (new Date().getMonth() + 1);
@@ -1087,7 +1053,7 @@ function renderCommitteeEvolution() {
         evo[c.established]['established'].push(c);
         evo[c.retired]['retired'].push(c);
     }
-
+    // compute data
     var data = [];
     var cur = 0;
     var d;
@@ -1138,6 +1104,44 @@ function renderCommitteeEvolution() {
     chart.draw(dataTable, options);
 }
 
+function renderPodlingsEvolution(obj) {
+    var earr = [];
+    var i
+    for (i in evolution) {
+        if (i > 260) {
+            break;
+        }
+        var evo = evolution[i];
+        earr.push([evo.month, evo.new, evo.graduated, evo.retired, evo.current]);
+    }
+    //narr.sort(function(a,b) { return (b[1] - a[1]) });
+    var data = new google.visualization.DataTable();
+    data.addColumn('string', 'Month');
+    data.addColumn('number', "New podlings");
+    data.addColumn('number', "Graduated podlings");
+    data.addColumn('number', "Retired podlings");
+    data.addColumn('number', 'Current podlings');
+    data.addRows(earr.reverse());
+
+    coptions = {
+        title: "Podling evolution",
+        isStacked: true,
+        height: 320,
+        width: 1160,
+        seriesType: "bars",
+        backgroundColor: 'transparent',
+        series: {3: {type: "line", targetAxisIndex: 1}},
+        vAxes: [
+            {title: 'Change in states'},
+            {title: 'Current number of podlings'}
+        ]
+    };
+    var div = document.createElement('div');
+    document.getElementById('details').appendChild(div);
+    chart = new google.visualization.ComboChart(div);
+    chart.draw(data, coptions);
+}
+
 function renderLanguageChart() {
     var obj = document.getElementById('contents');
     var chartDiv = document.createElement('div');



Mime
View raw message