]> git.donarmstrong.com Git - neurodebian.git/blobdiff - sphinx/_static/popconchart.js
ENH: sort versions and provide colors to group debian/ubuntus in popcon plot
[neurodebian.git] / sphinx / _static / popconchart.js
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)