]> git.donarmstrong.com Git - neurodebian.git/commitdiff
ENH: sort versions and provide colors to group debian/ubuntus in popcon plot
authorYaroslav Halchenko <debian@onerussian.com>
Tue, 21 May 2013 03:02:28 +0000 (23:02 -0400)
committerYaroslav Halchenko <debian@onerussian.com>
Tue, 21 May 2013 03:02:28 +0000 (23:02 -0400)
now expanded makes sense -- we have more debians

sphinx/_static/popconchart.js
tools/nd_popcon2stats

index 4fa7d83894f7d74c7ae820f230a1d2989326ce8f..0acea22afbb5d5b948dea37ff400f3372ce3284b 100644 (file)
@@ -1,8 +1,22 @@
+var colors_debian = d3.scale.linear()
+       .domain([1.43, 1.58]).range(["white", "#dd1155"])
+var colors_ubuntu = d3.scale.linear()
+       .domain([1.43, 1.58]).range(["white", "#dd4814"])
+
+keyColor = function(d, i) {
+       var version = parseFloat(d.key.substr(0, 4))
+       if (d.key.indexOf("ubuntu") > 0)
+               return colors_ubuntu(version)
+       else
+               return colors_debian(version);
+}
+
 d3.json('/_files/nd_popconstats.json', function(data) {
   nv.addGraph(function() {
     chart = nv.models.stackedAreaChart()
                   .x(function(d) { return d[0] })
                   .y(function(d) { return d[1] })
+                  .color(keyColor)
                   .clipEdge(true);
 
     chart.stacked.style('stacked');
@@ -12,7 +26,7 @@ d3.json('/_files/nd_popconstats.json', function(data) {
             return d3.time.format('%d %b %Y')(new Date(d)) });
 
     chart.yAxis
-        .tickFormat(d3.format(',.2f'));
+        .tickFormat(d3.format(',d'));
 
     d3.select('#popconchart')
       .datum(data)
index 0fd57d19088d35ac469233743f6d7daec7897e29..488f6dec8893047b484ad0245889cee894e0a358 100755 (executable)
@@ -97,11 +97,14 @@ if __name__ == '__main__':
             popcon_[date_int] = count + popcon_.get(date_int, 0)
             timestamps.add(date_int)
 
+    versions = sorted([x for x in popcon_versions.keys() if not 'ubuntu' in x]) + \
+               sorted([x for x in popcon_versions.keys() if     'ubuntu' in x])
+
     # we need to make sure that for every date we have an entry for
     # every version, otherwise d3 pukes because of ... d3.v2.js:expand
     export = [{'key': k,
                'values': [[date, popcon_versions[k].get(date, 0)/coarsen_days]
                           for date in sorted(list(timestamps))]}
-              for k in sorted(popcon_versions.keys())]
+              for k in versions]
     print json.dumps(export)