+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');
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)
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)