]> git.donarmstrong.com Git - neurodebian.git/blob - sphinx/_static/popconchart.js
0acea22afbb5d5b948dea37ff400f3372ce3284b
[neurodebian.git] / sphinx / _static / popconchart.js
1 var colors_debian = d3.scale.linear()
2         .domain([1.43, 1.58]).range(["white", "#dd1155"])
3 var colors_ubuntu = d3.scale.linear()
4         .domain([1.43, 1.58]).range(["white", "#dd4814"])
5
6 keyColor = function(d, i) {
7         var version = parseFloat(d.key.substr(0, 4))
8         if (d.key.indexOf("ubuntu") > 0)
9                 return colors_ubuntu(version)
10         else
11                 return colors_debian(version);
12 }
13
14 d3.json('/_files/nd_popconstats.json', function(data) {
15   nv.addGraph(function() {
16     chart = nv.models.stackedAreaChart()
17                   .x(function(d) { return d[0] })
18                   .y(function(d) { return d[1] })
19                   .color(keyColor)
20                   .clipEdge(true);
21
22     chart.stacked.style('stacked');
23
24     chart.xAxis
25         .tickFormat(function(d) {
26             return d3.time.format('%d %b %Y')(new Date(d)) });
27
28     chart.yAxis
29         .tickFormat(d3.format(',d'));
30
31     d3.select('#popconchart')
32       .datum(data)
33         .transition().duration(500).call(chart);
34
35     nv.utils.windowResize(chart.update);
36
37     return chart;
38   });
39 })