Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'bullet'

  • Loading branch information...
commit 57f2ecf2c1dfc31e84aaf5f14d1304961266c4b2 2 parents 2130575 + 674eded
@mbostock mbostock authored
View
8 Makefile
@@ -6,6 +6,8 @@ all: \
d3.min.js \
d3.behavior.js \
d3.behavior.min.js \
+ d3.chart.js \
+ d3.chart.min.js \
d3.layout.js \
d3.layout.min.js \
d3.csv.js \
@@ -88,6 +90,12 @@ d3.behavior.js: \
src/behavior/zoom.js \
src/end.js
+d3.chart.js: \
+ src/start.js \
+ src/chart/chart.js \
+ src/chart/bullet.js \
+ src/end.js
+
d3.layout.js: \
src/start.js \
src/layout/layout.js \
View
2  d3.behavior.js
@@ -108,7 +108,7 @@ d3.behavior.zoom = function() {
};
function transform(scale, o) {
- var domain = scale.__domain || (scale.__domain = scale.domain());
+ var domain = scale.__domain || (scale.__domain = scale.domain()),
range = scale.range().map(function(v) { return (v - o) / k; });
scale.domain(domain).domain(range.map(scale.invert));
}
View
2  d3.behavior.min.js
@@ -1 +1 @@
-(function(){d3.behavior={},d3.behavior.zoom=function(){function m(a,b){function i(a,b){var c=a.__domain||(a.__domain=a.domain());range=a.range().map(function(a){return(a-b)/h}),a.domain(c).domain(range.map(a.invert))}var g=d3.event,h=Math.pow(2,e);d3.event={scale:h,translate:[c,d],transform:function(a,b){a&&i(a,c),b&&i(b,d)}};try{for(var j=0,k=f.length;j<k;j++)f[j].call(this,a,b)}finally{d3.event=g}}function l(f,g){var i=d3.event;if(!h){var j=d3.svg.mouse(this.nearestViewportElement||this);h={x0:c,y0:d,z0:e,x1:c-j[0],y1:d-j[1]}}if(i.type=="dblclick")e=i.shiftKey?Math.ceil(e-1):Math.floor(e+1);else{var k=(i.wheelDelta/120||-i.detail)*.1;if(a<0){var l=Date.now(),n=l-b;n>9&&Math.abs(i.wheelDelta)/n>=50&&(a=1),b=l}a==1&&(k*=.03),e+=k}var o=Math.pow(2,e-h.z0)-1;c=h.x0+h.x1*o,d=h.y0+h.y1*o,m.call(this,f,g)}function k(){g&&(j(),g=null)}function j(){h=null,g&&(c=d3.event.clientX+g.x0,d=d3.event.clientY+g.y0,m.call(g.target,g.data,g.index))}function i(a,b){g={x0:c-d3.event.clientX,y0:d-d3.event.clientY,target:this,data:a,index:b},d3.event.preventDefault(),window.focus()}function h(){var a=this.on("mousedown",i).on("mousewheel",l).on("DOMMouseScroll",l).on("dblclick",l);d3.select(window).on("mousemove",j).on("mouseup",k)}var a=/WebKit\/533/.test(navigator.userAgent)?-1:0,b=0,c=0,d=0,e=0,f=[],g,h;h.on=function(a,b){a=="zoom"&&f.push(b);return h};return h}})()
+(function(){d3.behavior={},d3.behavior.zoom=function(){function m(a,b){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var g=d3.event,h=Math.pow(2,e);d3.event={scale:h,translate:[c,d],transform:function(a,b){a&&i(a,c),b&&i(b,d)}};try{for(var j=0,k=f.length;j<k;j++)f[j].call(this,a,b)}finally{d3.event=g}}function l(f,g){var i=d3.event;if(!h){var j=d3.svg.mouse(this.nearestViewportElement||this);h={x0:c,y0:d,z0:e,x1:c-j[0],y1:d-j[1]}}if(i.type=="dblclick")e=i.shiftKey?Math.ceil(e-1):Math.floor(e+1);else{var k=(i.wheelDelta/120||-i.detail)*.1;if(a<0){var l=Date.now(),n=l-b;n>9&&Math.abs(i.wheelDelta)/n>=50&&(a=1),b=l}a==1&&(k*=.03),e+=k}var o=Math.pow(2,e-h.z0)-1;c=h.x0+h.x1*o,d=h.y0+h.y1*o,m.call(this,f,g)}function k(){g&&(j(),g=null)}function j(){h=null,g&&(c=d3.event.clientX+g.x0,d=d3.event.clientY+g.y0,m.call(g.target,g.data,g.index))}function i(a,b){g={x0:c-d3.event.clientX,y0:d-d3.event.clientY,target:this,data:a,index:b},d3.event.preventDefault(),window.focus()}function h(){var a=this.on("mousedown",i).on("mousewheel",l).on("DOMMouseScroll",l).on("dblclick",l);d3.select(window).on("mousemove",j).on("mouseup",k)}var a=/WebKit\/533/.test(navigator.userAgent)?-1:0,b=0,c=0,d=0,e=0,f=[],g,h;h.on=function(a,b){a=="zoom"&&f.push(b);return h};return h}})()
View
240 d3.chart.js
@@ -0,0 +1,240 @@
+(function(){d3.chart = {};
+// ranges (bad, satisfactory, good)
+// measures (actual, forecast)
+// markers (previous, goal)
+
+/*
+ * Chart design based on the recommendations of Stephen Few. Implementation
+ * based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+ * http://projects.instantcognition.com/protovis/bulletchart/
+ */
+
+d3.chart.bullet = function() {
+ var orient = "left", // TODO top & bottom
+ reverse = false,
+ duration = 0,
+ ranges = d3_chart_bulletRanges,
+ markers = d3_chart_bulletMarkers,
+ measures = d3_chart_bulletMeasures,
+ width = 380,
+ height = 30,
+ tickFormat = null;
+
+ // For each small multiple…
+ function bullet(g) {
+ g.each(function(d, i) {
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
+ g = d3.select(this);
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
+ .range(reverse ? [width, 0] : [0, width]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ // Derive width-scales from the x-scales.
+ var w0 = d3_chart_bulletWidth(x0),
+ w1 = d3_chart_bulletWidth(x1);
+
+ // Update the range rects.
+ var range = g.selectAll("rect.range")
+ .data(rangez);
+
+ range.enter().append("svg:rect")
+ .attr("class", function(d, i) { return "range s" + i; })
+ .attr("width", w0)
+ .attr("height", height)
+ .attr("x", reverse ? x0 : 0)
+ .transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("x", reverse ? x1 : 0);
+
+ range.transition()
+ .duration(duration)
+ .attr("x", reverse ? x1 : 0)
+ .attr("width", w1)
+ .attr("height", height);
+
+ // Update the measure rects.
+ var measure = g.selectAll("rect.measure")
+ .data(measurez);
+
+ measure.enter().append("svg:rect")
+ .attr("class", function(d, i) { return "measure s" + i; })
+ .attr("width", w0)
+ .attr("height", height / 3)
+ .attr("x", reverse ? x0 : 0)
+ .attr("y", height / 3)
+ .transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("x", reverse ? x1 : 0);
+
+ measure.transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("height", height / 3)
+ .attr("x", reverse ? x1 : 0)
+ .attr("y", height / 3);
+
+ // Update the marker lines.
+ var marker = g.selectAll("line.marker")
+ .data(markerz);
+
+ marker.enter().append("svg:line")
+ .attr("class", "marker")
+ .attr("x1", x0)
+ .attr("x2", x0)
+ .attr("y1", height / 6)
+ .attr("y2", height * 5 / 6)
+ .transition()
+ .duration(duration)
+ .attr("x1", x1)
+ .attr("x2", x1);
+
+ marker.transition()
+ .duration(duration)
+ .attr("x1", x1)
+ .attr("x2", x1)
+ .attr("y1", height / 6)
+ .attr("y2", height * 5 / 6);
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat(8);
+
+ // Update the tick groups.
+ var tick = g.selectAll("g.tick")
+ .data(x1.ticks(8), format);
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append("svg:g")
+ .attr("class", "tick")
+ .attr("transform", d3_chart_bulletTranslate(x0))
+ .attr("opacity", 1e-6);
+
+ tickEnter.append("svg:line")
+ .attr("y1", height)
+ .attr("y2", height * 7 / 6);
+
+ tickEnter.append("svg:text")
+ .attr("text-anchor", "middle")
+ .attr("dy", "1em")
+ .attr("y", height * 7 / 6)
+ .text(format);
+
+ // Transition the entering ticks to the new scale, x1.
+ tickEnter.transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .attr("opacity", 1);
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = tick.transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .attr("opacity", 1);
+
+ tickUpdate.select("line")
+ .attr("y1", height)
+ .attr("y2", height * 7 / 6);
+
+ tickUpdate.select("text")
+ .attr("y", height * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ tick.exit().transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .attr("opacity", 1e-6)
+ .remove();
+ });
+ }
+
+ // left, right, top, bottom
+ bullet.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == "right" || orient == "bottom";
+ return bullet;
+ };
+
+ bullet.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return bullet;
+ };
+
+ bullet.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return bullet;
+ };
+
+ bullet.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return bullet;
+ };
+
+ bullet.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return bullet;
+ };
+
+ bullet.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return bullet;
+ };
+
+ bullet.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return bullet;
+ };
+
+ bullet.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = x;
+ return bullet;
+ };
+
+ return bullet;
+};
+
+function d3_chart_bulletRanges(d) {
+ return d.ranges;
+}
+
+function d3_chart_bulletMarkers(d) {
+ return d.markers;
+}
+
+function d3_chart_bulletMeasures(d) {
+ return d.measures;
+}
+
+function d3_chart_bulletTranslate(x) {
+ return function(d) {
+ return "translate(" + x(d) + ",0)";
+ };
+}
+
+function d3_chart_bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x0);
+ };
+}
+})()
View
1  d3.chart.min.js
@@ -0,0 +1 @@
+(function(){function e(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function d(a){return function(b){return"translate("+a(b)+",0)"}}function c(a){return a.measures}function b(a){return a.markers}function a(a){return a.ranges}d3.chart={},d3.chart.bullet=function(){function o(a){a.each(function(a,b){var c=i.call(this,a,b).slice().sort(d3.descending),f=j.call(this,a,b).slice().sort(d3.descending),o=k.call(this,a,b).slice().sort(d3.descending),p=d3.select(this),q=d3.scale.linear().domain([0,Math.max(c[0],f[0],o[0])]).range(g?[l,0]:[0,l]),r=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(q.range());this.__chart__=q;var s=e(r),t=e(q),u=p.selectAll("rect.range").data(c);u.enter().append("svg:rect").attr("class",function(a,b){return"range s"+b}).attr("width",s).attr("height",m).attr("x",g?r:0).transition().duration(h).attr("width",t).attr("x",g?q:0),u.transition().duration(h).attr("x",g?q:0).attr("width",t).attr("height",m);var v=p.selectAll("rect.measure").data(o);v.enter().append("svg:rect").attr("class",function(a,b){return"measure s"+b}).attr("width",s).attr("height",m/3).attr("x",g?r:0).attr("y",m/3).transition().duration(h).attr("width",t).attr("x",g?q:0),v.transition().duration(h).attr("width",t).attr("height",m/3).attr("x",g?q:0).attr("y",m/3);var w=p.selectAll("line.marker").data(f);w.enter().append("svg:line").attr("class","marker").attr("x1",r).attr("x2",r).attr("y1",m/6).attr("y2",m*5/6).transition().duration(h).attr("x1",q).attr("x2",q),w.transition().duration(h).attr("x1",q).attr("x2",q).attr("y1",m/6).attr("y2",m*5/6);var x=n||q.tickFormat(8),y=p.selectAll("g.tick").data(q.ticks(8),x),z=y.enter().append("svg:g").attr("class","tick").attr("transform",d(r)).attr("opacity",1e-6);z.append("svg:line").attr("y1",m).attr("y2",m*7/6),z.append("svg:text").attr("text-anchor","middle").attr("dy","1em").attr("y",m*7/6).text(x),z.transition().duration(h).attr("transform",d(q)).attr("opacity",1);var A=y.transition().duration(h).attr("transform",d(q)).attr("opacity",1);A.select("line").attr("y1",m).attr("y2",m*7/6),A.select("text").attr("y",m*7/6),y.exit().transition().duration(h).attr("transform",d(q)).attr("opacity",1e-6).remove()})}var f="left",g=!1,h=0,i=a,j=b,k=c,l=380,m=30,n=null;o.orient=function(a){if(!arguments.length)return f;f=a,g=f=="right"||f=="bottom";return o},o.ranges=function(a){if(!arguments.length)return i;i=a;return o},o.markers=function(a){if(!arguments.length)return j;j=a;return o},o.measures=function(a){if(!arguments.length)return k;k=a;return o},o.width=function(a){if(!arguments.length)return l;l=a;return o},o.height=function(a){if(!arguments.length)return m;m=a;return o},o.tickFormat=function(a){if(!arguments.length)return n;n=a;return o},o.duration=function(a){if(!arguments.length)return h;h=a;return o};return o}})()
View
39 d3.js
@@ -1,4 +1,4 @@
-(function(){d3 = {version: "1.8.5"}; // semver
+(function(){d3 = {version: "1.9.0"}; // semver
if (!Date.now) Date.now = function() {
return +new Date();
};
@@ -1033,7 +1033,6 @@ function d3_selection(groups) {
group = groups[j];
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
- subgroup.parentData = group.parentData;
for (var i = 0, n = group.length; i < n; i++) {
if (node = group[i]) {
subgroup.push(subnode = select(node));
@@ -1057,7 +1056,6 @@ function d3_selection(groups) {
if (node = group[i]) {
subgroups.push(subgroup = selectAll(node));
subgroup.parentNode = node;
- subgroup.parentData = node.__data__;
}
}
}
@@ -1088,7 +1086,6 @@ function d3_selection(groups) {
group = groups[j];
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
- subgroup.parentData = group.parentData;
for (var i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i)) {
subgroup.push(node);
@@ -1128,13 +1125,8 @@ function d3_selection(groups) {
node,
nodeData;
- function enterNode(data) {
- return {__data__: data};
- }
-
if (join) {
var nodeByKey = {},
- exitData = [],
keys = [],
key,
j = groupData.length;
@@ -1142,11 +1134,11 @@ function d3_selection(groups) {
for (i = 0; i < n; i++) {
key = join.call(node = group[i], node.__data__, i);
if (key in nodeByKey) {
- exitNodes[j++] = group[i];
+ exitNodes[j++] = group[i]; // duplicate key
} else {
nodeByKey[key] = node;
- keys.push(key);
}
+ keys.push(key);
}
for (i = 0; i < m; i++) {
@@ -1156,7 +1148,7 @@ function d3_selection(groups) {
updateNodes[i] = node;
enterNodes[i] = exitNodes[i] = null;
} else {
- enterNodes[i] = enterNode(nodeData),
+ enterNodes[i] = d3_selection_enterNode(nodeData);
updateNodes[i] = exitNodes[i] = null;
}
delete nodeByKey[key];
@@ -1176,12 +1168,12 @@ function d3_selection(groups) {
updateNodes[i] = node;
enterNodes[i] = exitNodes[i] = null;
} else {
- enterNodes[i] = enterNode(nodeData);
+ enterNodes[i] = d3_selection_enterNode(nodeData);
updateNodes[i] = exitNodes[i] = null;
}
}
for (; i < m; i++) {
- enterNodes[i] = enterNode(groupData[i]);
+ enterNodes[i] = d3_selection_enterNode(groupData[i]);
updateNodes[i] = exitNodes[i] = null;
}
for (; i < n1; i++) {
@@ -1195,11 +1187,6 @@ function d3_selection(groups) {
= exitNodes.parentNode
= group.parentNode;
- enterNodes.parentData
- = updateNodes.parentData
- = exitNodes.parentData
- = group.parentData;
-
enter.push(enterNodes);
update.push(updateNodes);
exit.push(exitNodes);
@@ -1210,7 +1197,7 @@ function d3_selection(groups) {
group;
if (typeof data == "function") {
while (++i < n) {
- bind(group = groups[i], data.call(group, group.parentData, i));
+ bind(group = groups[i], data.call(group, group.parentNode.__data__, i));
}
} else {
while (++i < n) {
@@ -1508,10 +1495,9 @@ function d3_selection(groups) {
// TODO remove(node)?
// TODO remove(function)?
groups.remove = function() {
- return select(function(node) {
- var parent = node.parentNode;
- parent.removeChild(node);
- return parent;
+ return groups.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
});
};
@@ -1581,7 +1567,6 @@ function d3_selectionEnter(groups) {
group = groups[j];
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
- subgroup.parentData = group.parentData;
for (var i = 0, n = group.length; i < n; i++) {
if (node = group[i]) {
subgroup.push(subnode = select(group.parentNode));
@@ -1640,6 +1625,10 @@ function d3_selection_comparator(comparator) {
return comparator(a && a.__data__, b && b.__data__);
};
}
+
+function d3_selection_enterNode(data) {
+ return {__data__: data};
+}
d3.transition = d3_root.transition;
var d3_transitionId = 0,
View
4 d3.min.js
@@ -1,2 +1,2 @@
-(function(){function bT(){return"circle"}function bS(){return 64}function bQ(a){return a.endAngle}function bP(a){return a.startAngle}function bO(a){return a.radius}function bN(a){return a.target}function bM(a){return a.source}function bL(){return 0}function bK(a,b,c){a.push("C",bG(bH,b),",",bG(bH,c),",",bG(bI,b),",",bG(bI,c),",",bG(bJ,b),",",bG(bJ,c))}function bG(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bF(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bG(bJ,g),",",bG(bJ,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bK(b,g,h);return b.join("")}function bE(a){if(a.length<3)return bx(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bK(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bK(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bK(b,h,i);return b.join("")}function bD(a,b){var c=[],d=(1-b)/2,e=a[0],f=a[1],g=a[2],h=2,i=a.length;while(++h<i)c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]),e=f,f=g,g=a[h];c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bC(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bx(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bB(a,b,c){return a.length<3?bx(a):a[0]+bC(a,bD(a,b))}function bA(a,b){return a.length<3?bx(a):a[0]+bC(a,bD([a[a.length-2]].concat(a,[a[1]]),b))}function bz(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function by(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bx(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bv(a){return a[1]}function bu(a){return a[0]}function bt(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bs(a){return a.endAngle}function br(a){return a.startAngle}function bq(a){return a.outerRadius}function bp(a){return a.innerRadius}function bi(a){return function(b){return-Math.pow(-b,a)}}function bh(a){return function(b){return Math.pow(b,a)}}function bg(a){return-Math.log(-a)/Math.LN10}function bf(a){return Math.log(a)/Math.LN10}function bd(){var a=null,b=Z;while(b)b=b.flush?a?a.next=b.next:Z=b.next:(a=b).next;a||(_=0)}function bc(){var a,b=Date.now(),c=null,d=Z;while(d)a=b-d.then,a>d.delay&&(d.flush=d.callback(a)),d=(c=d).next;bd(),_&&be(bc)}function bb(){_=1,$=0,be(bc)}function ba(a,b){var c=Date.now(),d=!1,e=c+b,f,g=Z;if(!!isFinite(b)){while(g){if(g.callback==a)g.then=c,g.delay=b,d=!0;else{var h=g.then+g.delay;h<e&&(e=h)}f=g,g=g.next}d||(Z={callback:a,then:c,delay:b,next:Z}),_||(clearTimeout($),$=setTimeout(bb,Math.max(24,e-c)))}}function Y(a){return typeof a=="function"?function(b,c,d){return d3.interpolate(d,String(a.call(this,b,c)))}:(a=String(a),function(b,c,d){return d3.interpolate(d,a)})}function X(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!=2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!=c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)q[p]=d[p].apply(this,arguments)}o=m(a);for(p in d)q[p].call(this,o);if(a==1){i[l]=2;if(n.active==c){var r=n.owner;r==c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),W=c,g.end.dispatch.apply(this,arguments),W=0,n.owner=r}}}});return h}var b={},c=W||++V,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),ba(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,Y(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,Y(c),d)},b.select=function(b){var c,d=X(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=X(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function U(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function T(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode,d.parentData=f.parentData;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return S(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),P(c,b))}function d(b){return b.insertBefore(document.createElement(a),P(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function S(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f,d.parentData=f.__data__}return S(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode,d.parentData=f.parentData;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return S(c)}a.select=function(a){return b(function(b){return P(a,b)})},a.selectAll=function(a){return c(function(b){return Q(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode,d.parentData=e.parentData;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return S(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){function q(a){return{__data__:a}}var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var r={},s=[],t=[],u,v=b.length;for(g=0;g<h;g++)u=c.call(o=a[g],o.__data__,g),u in r?n[v++]=a[g]:(r[u]=o,t.push(u));for(g=0;g<i;g++)o=r[u=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=q(p),l[g]=n[g]=null),delete r[u];for(g=0;g<h;g++)t[g]in r&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=q(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=q(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,m.parentData=l.parentData=n.parentData=a.parentData,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentData,h));else while(++h<i)g(j=a[h],b);var k=S(e);k.enter=function(){return T(d)},k.exit=function(){return S(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){var a=g(this.className.replace(e," "));this.className=a.length?a:null}function f(){var a=this.className;e.lastIndex=0,e.test(a)||(this.className=g(a+" "+b))}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){e.lastIndex=0;return e.test(this.className)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e=null);if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function f(){var a=b.apply(this,arguments);a!=null&&this.appendChild(document.createTextNode(a))}function e(){this.appendChild(document.createTextNode(b))}function c(){while(this.lastChild)this.removeChild(this.lastChild)}if(arguments.length<1)return d(function(){return this.textContent});a.each(c);return b==null?a:a.each(typeof b=="function"?f:e)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),P(c,b))}function d(b){return b.insertBefore(document.createElement(a),P(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return b(function(a){var b=a.parentNode;b.removeChild(a);return b})},a.sort=function(b){b=U.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c){var d=b.indexOf("."),e=d==-1?b:b.substring(0,d),f="__on"+b;return a.each(function(a,b){function d(d){var e=d3.event;d3.event=d;try{c.call(this,a,b)}finally{d3.event=e}}this[f]&&this.removeEventListener(e,this[f],!1),c&&this.addEventListener(e,this[f]=d,!1)})},a.transition=function(){return X(a)},a.call=h;return a}function O(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return E(g(a+120),g(a),g(a-120))}function N(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function M(a,b,c){return{h:a,s:b,l:c,toString:N}}function J(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function I(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return M(g,h,i)}function H(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(J(h[0]),J(h[1]),J(h[2]))}}if(i=K[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)=="#"&&(a.length==4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length==7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function G(a){return a<16?"0"+a.toString(16):a.toString(16)}function F(){return"#"+G(this.r)+G(this.g)+G(this.b)}function E(a,b,c){return{r:a,g:b,b:c,toString:F}}function D(a){return a in C||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function z(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function y(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function x(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function w(a){return 1-Math.sqrt(1-a*a)}function v(a){return a?Math.pow(2,10*(a-1))-.001:0}function u(a){return 1-Math.cos(a*Math.PI/2)}function t(a){return function(b){return Math.pow(b,a)}}function s(a){return a}function r(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function q(a){return function(b){return 1-a(1-b)}}function l(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return typeof a=="function"?a:function(){return a}}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.8.5"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e>(f=a[c])&&(e=f);else{e=b(a[0]);while(++c<d)e>(f=b(a[c]))&&(e=f)}return e},d3.max=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e<(f=a[c])&&(e=f);else{e=b(e);while(++c<d)e<(f=b(a[c]))&&(e=f)}return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length==1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState==4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9];h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4))),i=="d"&&(h="0");return function(a){var b=+a,j=b<0&&(b=-b)?"−":d;if(i=="d"&&b%1)return"";h?a=b.toFixed(h):a=""+b;if(e){var k=a.length+j.length;k<f&&(a=Array(f-k+1).join(c)+a),g&&(a=l(a)),a=j+a}else{g&&(a=l(a)),a=j+a;var k=a.length;k<f&&(a=Array(f-k+1).join(c)+a)}return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,m=t(2),n=t(3),o={linear:function(){return s},poly:t,quad:function(){return m},cubic:function(){return n},sin:function(){return u},exp:function(){return v},circle:function(){return w},elastic:x,back:y,bounce:function(){return z}},p={"in":function(a){return a},out:q,"in-out":r,"out-in":function(a){return r(q(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return p[d](o[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in K||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;for(d=0;c=A.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=A.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=A.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length==1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return O(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=D(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var A=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,B=/[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/,C={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?H(""+a,E,O):E(~~a,~~b,~~c)};var K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var L in K)K[L]=H(K[L],E,O);d3.hsl=function(a,b,c){return arguments.length==1?H(""+a,I,M):M(+a,+b,+c)};var P=function(a,b){return b.querySelector(a)},Q=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(P=function(a,b){return Sizzle(a,b)[0]},Q=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var R=S([[document]]);R[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?R.select(a):S([[a]])},d3.selectAll=function(b){return typeof b=="string"?R.selectAll(b):S([a(b)])},d3.transition=R.transition;var V=0,W=0,Z=null,$=0,_;d3.timer=function(a){ba(a,0)};var be=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function j(c){var d=Math.min(a,b),e=Math.max(a,b),f=e-d,g=Math.pow(10,Math.floor(Math.log(f/c)/Math.LN10)),h=c/(f/g);h<=.15?g*=10:h<=.35?g*=5:h<=.75&&(g*=2);return{start:Math.ceil(d/g)*g,stop:Math.floor(e/g)*g+g*.5,step:g}}function i(b){return h((b-a)*e)}var a=0,b=1,c=0,d=1,e=1,f=1,g=d3.interpolate,h=g(c,d);i.invert=function(b){return(b-c)*f+a},i.domain=function(g){if(!arguments.length)return[a,b];a=+g[0],b=+g[1],e=1/(b-a),f=(b-a)/(d-c);return i},i.range=function(e){if(!arguments.length)return[c,d];c=e[0],d=e[1],f=(b-a)/(d-c),h=g(c,d);return i},i.rangeRound=function(a){return i.range(a).interpolate(d3.interpolateRound)},i.interpolate=function(a){if(!arguments.length)return g;h=(g=a)(c,d);return i},i.ticks=function(a){var b=j(a);return d3.range(b.start,b.stop,b.step)},i.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(j(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return i},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bf,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bg:bf,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.ticks=function(){var d=a.domain(),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bg){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},bf.pow=function(a){return Math.pow(10,a)},bg.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f(b){return a(d(b))}var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bi:bh;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(bj)},d3.scale.category20=function(){return d3.scale.ordinal().range(bk)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bl)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bm)};var bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bk=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bl=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bm=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function f(a){return b[e(a)]}function e(a){if(isNaN(a=+a))return NaN;var b=0,d=c.length-1;while(b<=d){var e=b+d>>1,f=c[e];if(f<a)b=e+1;else if(f>a)d=e-1;else return e}return d<0?0:d}function d(){var d=-1,e=c.length=b.length,f=a.length/e;while(++d<e)c[d]=a[~~(d*f)]}var a=[],b=[],c=[];f.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return f},f.range=function(a){if(!arguments.length)return b;b=a,d();return f},f.quantiles=function(){return c};return f},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function f(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bn,h=d.apply(this,arguments)+bn,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bo?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bp,b=bq,c=br,d=bs;f.innerRadius=function(b){if(!arguments.length)return a;a=e(b);return f},f.outerRadius=function(a){if(!arguments.length)return b;b=e(a);return f},f.startAngle=function(a){if(!arguments.length)return c;c=e(a);return f},f.endAngle=function(a){if(!arguments.length)return d;d=e(a);return f},f.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bn;return[Math.cos(f)*e,Math.sin(f)*e]};return f};var bn=-Math.PI/2,bo=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bt(this,c,a,b),e)}var a=bu,b=bv,c="linear",d=bw[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bw[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bw={linear:bx,"step-before":by,"step-after":bz,basis:bE,"basis-closed":bF,cardinal:bB,"cardinal-closed":bA},bH=[0
-,2/3,1/3,0],bI=[0,1/3,2/3,0],bJ=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bt(this,d,a,c),f)+"L"+e(bt(this,d,a,b).reverse(),f)+"Z"}var a=bu,b=bL,c=bv,d="linear",e=bw[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bw[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function k(a,b,c,d){return"Q 0,0 "+d}function j(a,b){return"A"+a+","+a+" 0 0,1 "+b}function i(a,b){return a.a0==b.a0&&a.a1==b.a1}function h(a,b,e,g){var h=b.call(a,e,g),i=c.call(a,h,g),j=d.call(a,h,g)+bn,k=f.call(a,h,g)+bn;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function g(c,d){var e=h(this,a,c,d),f=h(this,b,c,d);return"M"+e.p0+j(e.r,e.p1)+(i(e,f)?k(e.r,e.p1,e.r,e.p0):k(e.r,e.p1,f.r,f.p0)+j(f.r,f.p1)+k(f.r,f.p1,e.r,e.p0))+"Z"}var a=bM,b=bN,c=bO,d=br,f=bs;g.radius=function(a){if(!arguments.length)return c;c=e(a);return g},g.source=function(b){if(!arguments.length)return a;a=e(b);return g},g.target=function(a){if(!arguments.length)return b;b=e(a);return g},g.startAngle=function(a){if(!arguments.length)return d;d=e(a);return g},g.endAngle=function(a){if(!arguments.length)return f;f=e(a);return g};return g},d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(bR<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),d=c[0][0].getScreenCTM();bR=!d.f&&!d.e,c.remove()}bR?(b.x=d3.event.pageX,b.y=d3.event.pageY):(b.x=d3.event.clientX,b.y=d3.event.clientY),b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var bR=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function c(c,d){return(bU[a.call(this,c,d)]||bU.circle)(b.call(this,c,d))}var a=bT,b=bS;c.type=function(b){if(!arguments.length)return a;a=e(b);return c},c.size=function(a){if(!arguments.length)return b;b=e(a);return c};return c},d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var bU={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*bW)),c=b*bW;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/bV),c=b*bV/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/bV),c=b*bV/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},bV=Math.sqrt(3),bW=Math.tan(30*Math.PI/180)})()
+(function(){function bU(){return"circle"}function bT(){return 64}function bR(a){return a.endAngle}function bQ(a){return a.startAngle}function bP(a){return a.radius}function bO(a){return a.target}function bN(a){return a.source}function bM(){return 0}function bL(a,b,c){a.push("C",bH(bI,b),",",bH(bI,c),",",bH(bJ,b),",",bH(bJ,c),",",bH(bK,b),",",bH(bK,c))}function bH(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bG(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bH(bK,g),",",bH(bK,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bL(b,g,h);return b.join("")}function bF(a){if(a.length<3)return by(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bL(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bL(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bL(b,h,i);return b.join("")}function bE(a,b){var c=[],d=(1-b)/2,e=a[0],f=a[1],g=a[2],h=2,i=a.length;while(++h<i)c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]),e=f,f=g,g=a[h];c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bD(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return by(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bC(a,b,c){return a.length<3?by(a):a[0]+bD(a,bE(a,b))}function bB(a,b){return a.length<3?by(a):a[0]+bD(a,bE([a[a.length-2]].concat(a,[a[1]]),b))}function bA(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bz(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function by(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bw(a){return a[1]}function bv(a){return a[0]}function bu(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bt(a){return a.endAngle}function bs(a){return a.startAngle}function br(a){return a.outerRadius}function bq(a){return a.innerRadius}function bj(a){return function(b){return-Math.pow(-b,a)}}function bi(a){return function(b){return Math.pow(b,a)}}function bh(a){return-Math.log(-a)/Math.LN10}function bg(a){return Math.log(a)/Math.LN10}function be(){var a=null,b=$;while(b)b=b.flush?a?a.next=b.next:$=b.next:(a=b).next;a||(ba=0)}function bd(){var a,b=Date.now(),c=null,d=$;while(d)a=b-d.then,a>d.delay&&(d.flush=d.callback(a)),d=(c=d).next;be(),ba&&bf(bd)}function bc(){ba=1,_=0,bf(bd)}function bb(a,b){var c=Date.now(),d=!1,e=c+b,f,g=$;if(!!isFinite(b)){while(g){if(g.callback==a)g.then=c,g.delay=b,d=!0;else{var h=g.then+g.delay;h<e&&(e=h)}f=g,g=g.next}d||($={callback:a,then:c,delay:b,next:$}),ba||(clearTimeout(_),_=setTimeout(bc,Math.max(24,e-c)))}}function Z(a){return typeof a=="function"?function(b,c,d){return d3.interpolate(d,String(a.call(this,b,c)))}:(a=String(a),function(b,c,d){return d3.interpolate(d,a)})}function Y(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!=2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!=c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)q[p]=d[p].apply(this,arguments)}o=m(a);for(p in d)q[p].call(this,o);if(a==1){i[l]=2;if(n.active==c){var r=n.owner;r==c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),X=c,g.end.dispatch.apply(this,arguments),X=0,n.owner=r}}}});return h}var b={},c=X||++W,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),bb(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,Z(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,Z(c),d)},b.select=function(b){var c,d=Y(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=Y(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function V(a){return{__data__:a}}function U(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function T(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return S(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),P(c,b))}function d(b){return b.insertBefore(document.createElement(a),P(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function S(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return S(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return S(c)}a.select=function(a){return b(function(b){return P(a,b)})},a.selectAll=function(a){return c(function(b){return Q(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return S(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=a[g]:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=V(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=V(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=V(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=S(e);k.enter=function(){return T(d)},k.exit=function(){return S(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){var a=g(this.className.replace(e," "));this.className=a.length?a:null}function f(){var a=this.className;e.lastIndex=0,e.test(a)||(this.className=g(a+" "+b))}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){e.lastIndex=0;return e.test(this.className)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e=null);if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function f(){var a=b.apply(this,arguments);a!=null&&this.appendChild(document.createTextNode(a))}function e(){this.appendChild(document.createTextNode(b))}function c(){while(this.lastChild)this.removeChild(this.lastChild)}if(arguments.length<1)return d(function(){return this.textContent});a.each(c);return b==null?a:a.each(typeof b=="function"?f:e)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),P(c,b))}function d(b){return b.insertBefore(document.createElement(a),P(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=U.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c){var d=b.indexOf("."),e=d==-1?b:b.substring(0,d),f="__on"+b;return a.each(function(a,b){function d(d){var e=d3.event;d3.event=d;try{c.call(this,a,b)}finally{d3.event=e}}this[f]&&this.removeEventListener(e,this[f],!1),c&&this.addEventListener(e,this[f]=d,!1)})},a.transition=function(){return Y(a)},a.call=h;return a}function O(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return E(g(a+120),g(a),g(a-120))}function N(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function M(a,b,c){return{h:a,s:b,l:c,toString:N}}function J(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function I(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return M(g,h,i)}function H(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(J(h[0]),J(h[1]),J(h[2]))}}if(i=K[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)=="#"&&(a.length==4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length==7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function G(a){return a<16?"0"+a.toString(16):a.toString(16)}function F(){return"#"+G(this.r)+G(this.g)+G(this.b)}function E(a,b,c){return{r:a,g:b,b:c,toString:F}}function D(a){return a in C||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function z(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function y(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function x(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function w(a){return 1-Math.sqrt(1-a*a)}function v(a){return a?Math.pow(2,10*(a-1))-.001:0}function u(a){return 1-Math.cos(a*Math.PI/2)}function t(a){return function(b){return Math.pow(b,a)}}function s(a){return a}function r(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function q(a){return function(b){return 1-a(1-b)}}function l(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return typeof a=="function"?a:function(){return a}}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.9.0"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e>(f=a[c])&&(e=f);else{e=b(a[0]);while(++c<d)e>(f=b(a[c]))&&(e=f)}return e},d3.max=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e<(f=a[c])&&(e=f);else{e=b(e);while(++c<d)e<(f=b(a[c]))&&(e=f)}return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length==1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState==4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9];h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4))),i=="d"&&(h="0");return function(a){var b=+a,j=b<0&&(b=-b)?"−":d;if(i=="d"&&b%1)return"";h?a=b.toFixed(h):a=""+b;if(e){var k=a.length+j.length;k<f&&(a=Array(f-k+1).join(c)+a),g&&(a=l(a)),a=j+a}else{g&&(a=l(a)),a=j+a;var k=a.length;k<f&&(a=Array(f-k+1).join(c)+a)}return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,m=t(2),n=t(3),o={linear:function(){return s},poly:t,quad:function(){return m},cubic:function(){return n},sin:function(){return u},exp:function(){return v},circle:function(){return w},elastic:x,back:y,bounce:function(){return z}},p={"in":function(a){return a},out:q,"in-out":r,"out-in":function(a){return r(q(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return p[d](o[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in K||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;for(d=0;c=A.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=A.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=A.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length==1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return O(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=D(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var A=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,B=/[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/,C={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?H(""+a,E,O):E(~~a,~~b,~~c)};var K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var L in K)K[L]=H(K[L],E,O);d3.hsl=function(a,b,c){return arguments.length==1?H(""+a,I,M):M(+a,+b,+c)};var P=function(a,b){return b.querySelector(a)},Q=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(P=function(a,b){return Sizzle(a,b)[0]},Q=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var R=S([[document]]);R[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?R.select(a):S([[a]])},d3.selectAll=function(b){return typeof b=="string"?R.selectAll(b):S([a(b)])},d3.transition=R.transition;var W=0,X=0,$=null,_=0,ba;d3.timer=function(a){bb(a,0)};var bf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function j(c){var d=Math.min(a,b),e=Math.max(a,b),f=e-d,g=Math.pow(10,Math.floor(Math.log(f/c)/Math.LN10)),h=c/(f/g);h<=.15?g*=10:h<=.35?g*=5:h<=.75&&(g*=2);return{start:Math.ceil(d/g)*g,stop:Math.floor(e/g)*g+g*.5,step:g}}function i(b){return h((b-a)*e)}var a=0,b=1,c=0,d=1,e=1,f=1,g=d3.interpolate,h=g(c,d);i.invert=function(b){return(b-c)*f+a},i.domain=function(g){if(!arguments.length)return[a,b];a=+g[0],b=+g[1],e=1/(b-a),f=(b-a)/(d-c);return i},i.range=function(e){if(!arguments.length)return[c,d];c=e[0],d=e[1],f=(b-a)/(d-c),h=g(c,d);return i},i.rangeRound=function(a){return i.range(a).interpolate(d3.interpolateRound)},i.interpolate=function(a){if(!arguments.length)return g;h=(g=a)(c,d);return i},i.ticks=function(a){var b=j(a);return d3.range(b.start,b.stop,b.step)},i.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(j(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return i},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bg,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bh:bg,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.ticks=function(){var d=a.domain(),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bh){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},bg.pow=function(a){return Math.pow(10,a)},bh.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f(b){return a(d(b))}var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bj:bi;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(bk)},d3.scale.category20=function(){return d3.scale.ordinal().range(bl)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bm)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bn)};var bk=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bl=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bm=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bn=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function f(a){return b[e(a)]}function e(a){if(isNaN(a=+a))return NaN;var b=0,d=c.length-1;while(b<=d){var e=b+d>>1,f=c[e];if(f<a)b=e+1;else if(f>a)d=e-1;else return e}return d<0?0:d}function d(){var d=-1,e=c.length=b.length,f=a.length/e;while(++d<e)c[d]=a[~~(d*f)]}var a=[],b=[],c=[];f.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return f},f.range=function(a){if(!arguments.length)return b;b=a,d();return f},f.quantiles=function(){return c};return f},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function f(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bo,h=d.apply(this,arguments)+bo,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bp?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bq,b=br,c=bs,d=bt;f.innerRadius=function(b){if(!arguments.length)return a;a=e(b);return f},f.outerRadius=function(a){if(!arguments.length)return b;b=e(a);return f},f.startAngle=function(a){if(!arguments.length)return c;c=e(a);return f},f.endAngle=function(a){if(!arguments.length)return d;d=e(a);return f},f.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bo;return[Math.cos(f)*e,Math.sin(f)*e]};return f};var bo=-Math.PI/2,bp=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bu(this,c,a,b),e)}var a=bv,b=bw,c="linear",d=bx[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bx[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bx={linear:by,"step-before":bz,"step-after":bA,basis:bF,"basis-closed":bG,cardinal:bC,"cardinal-closed":bB},bI=[0,2/3,1/3,0],bJ=[0,1/3,2/3,0],bK=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bu(this,d,a,c),f)+"L"+e(bu(this
+,d,a,b).reverse(),f)+"Z"}var a=bv,b=bM,c=bw,d="linear",e=bx[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bx[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function k(a,b,c,d){return"Q 0,0 "+d}function j(a,b){return"A"+a+","+a+" 0 0,1 "+b}function i(a,b){return a.a0==b.a0&&a.a1==b.a1}function h(a,b,e,g){var h=b.call(a,e,g),i=c.call(a,h,g),j=d.call(a,h,g)+bo,k=f.call(a,h,g)+bo;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function g(c,d){var e=h(this,a,c,d),f=h(this,b,c,d);return"M"+e.p0+j(e.r,e.p1)+(i(e,f)?k(e.r,e.p1,e.r,e.p0):k(e.r,e.p1,f.r,f.p0)+j(f.r,f.p1)+k(f.r,f.p1,e.r,e.p0))+"Z"}var a=bN,b=bO,c=bP,d=bs,f=bt;g.radius=function(a){if(!arguments.length)return c;c=e(a);return g},g.source=function(b){if(!arguments.length)return a;a=e(b);return g},g.target=function(a){if(!arguments.length)return b;b=e(a);return g},g.startAngle=function(a){if(!arguments.length)return d;d=e(a);return g},g.endAngle=function(a){if(!arguments.length)return f;f=e(a);return g};return g},d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(bS<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),d=c[0][0].getScreenCTM();bS=!d.f&&!d.e,c.remove()}bS?(b.x=d3.event.pageX,b.y=d3.event.pageY):(b.x=d3.event.clientX,b.y=d3.event.clientY),b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var bS=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function c(c,d){return(bV[a.call(this,c,d)]||bV.circle)(b.call(this,c,d))}var a=bU,b=bT;c.type=function(b){if(!arguments.length)return a;a=e(b);return c},c.size=function(a){if(!arguments.length)return b;b=e(a);return c};return c},d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var bV={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*bX)),c=b*bX;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/bW),c=b*bW/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/bW),c=b*bW/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},bW=Math.sqrt(3),bX=Math.tan(30*Math.PI/180)})()
View
52 examples/bullet/bullet-multiples.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bullet Chart (Multiples)</title>
+ <script type="text/javascript" src="../../d3.js"></script>
+ <script type="text/javascript" src="../../d3.chart.js"></script>
+ <script type="text/javascript" src="bullets.js"></script>
+ <link type="text/css" rel="stylesheet" href="bullet.css"/>
+ </head>
+ <body>
+ <script type="text/javascript">
+
+var w = 380,
+ h = 25,
+ m = [5, 40, 20, 120]; // top right bottom left
+
+var vis = d3.select("body").append("svg:svg")
+ .attr("width", w + m[1] + m[3])
+ .attr("height", (h + m[0] + m[2]) * bullets.length);
+
+var g = vis.selectAll("g.bullet")
+ .data(bullets)
+ .enter().append("svg:g")
+ .attr("class", "bullet")
+ .attr("transform", function(d, i) {
+ return "translate(" + m[3] + "," + (i * (h + m[0] + m[2]) + m[0]) + ")";
+ });
+
+g.append("svg:text")
+ .attr("class", "title")
+ .attr("text-anchor", "end")
+ .attr("dx", "-6")
+ .attr("y", h / 2)
+ .text(function(d) { return d.title; });
+
+g.append("svg:text")
+ .attr("class", "subtitle")
+ .attr("text-anchor", "end")
+ .attr("dx", "-6")
+ .attr("dy", "1em")
+ .attr("y", h / 2)
+ .text(function(d) { return d.subtitle; });
+
+var chart = d3.chart.bullet().width(w).height(h);
+
+g.each(function(d) {
+ d3.select(this).call(chart);
+});
+
+ </script>
+ </body>
+</html>
View
72 examples/bullet/bullet-randomize.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bullet Chart (Randomize)</title>
+ <script type="text/javascript" src="../../d3.js"></script>
+ <script type="text/javascript" src="../../d3.chart.js"></script>
+ <link type="text/css" rel="stylesheet" href="bullet.css"/>
+ </head>
+ <body>
+ <input type="button" value="Randomize!" onclick="randomize()"><br>
+ <script type="text/javascript">
+
+var w = 380,
+ h = 25,
+ m = [5, 40, 20, 120], // top right bottom left
+ n = 5;
+
+var chart = d3.chart.bullet()
+ .width(w)
+ .height(h)
+ .duration(1000);
+
+var vis = d3.select("body").append("svg:svg")
+ .attr("width", w + m[1] + m[3])
+ .attr("height", (h + m[0] + m[2]) * n);
+
+var g = vis.selectAll("g.bullet")
+ .data(randomBullets)
+ .enter().append("svg:g")
+ .attr("class", "bullet")
+ .attr("transform", function(d, i) {
+ return "translate(" + m[3] + "," + (i * (h + m[0] + m[2]) + m[0]) + ")";
+ });
+
+g.append("svg:text")
+ .attr("class", "title")
+ .attr("text-anchor", "end")
+ .attr("dx", "-6")
+ .attr("y", h / 2)
+ .text(function(d) { return d.title; });
+
+g.append("svg:text")
+ .attr("class", "subtitle")
+ .attr("text-anchor", "end")
+ .attr("dx", "-6")
+ .attr("dy", "1em")
+ .attr("y", h / 2)
+ .text(function(d) { return d.subtitle; });
+
+g.call(chart);
+
+function randomize() {
+ g.data(randomBullets).call(chart);
+}
+
+function randomBullets() {
+ var k = 10 + Math.random() * 90,
+ r = function() { return Math.random() * k; };
+ return d3.range(n).map(function(i) {
+ return {
+ title: String.fromCharCode(65 + i),
+ subtitle: "numbers",
+ ranges: d3.range(3).map(r),
+ markers: d3.range(1).map(r),
+ measures: d3.range(1).map(r)
+ };
+ });
+}
+
+ </script>
+ </body>
+</html>
View
10 examples/bullet/bullet.css
@@ -0,0 +1,10 @@
+.bullet { font: 10px sans-serif; }
+.bullet .marker { stroke: #000; stroke-width: 2px; }
+.bullet .tick line { stroke: #666; stroke-width: .5px; }
+.bullet .range.s0 { fill: #eee; }
+.bullet .range.s1 { fill: #ddd; }
+.bullet .range.s2 { fill: #ccc; }
+.bullet .measure.s0 { fill: lightsteelblue; }
+.bullet .measure.s1 { fill: steelblue; }
+.bullet .title { font-size: 14px; font-weight: bold; }
+.bullet .subtitle { fill: #999; }
View
54 examples/bullet/bullet.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bullet Chart</title>
+ <script type="text/javascript" src="../../d3.js"></script>
+ <script type="text/javascript" src="../../d3.chart.js"></script>
+ <link type="text/css" rel="stylesheet" href="bullet.css"/>
+ </head>
+ <body>
+ <script>
+
+var w = 500,
+ h = 50,
+ m = [5, 40, 20, 120]; // top right bottom left
+
+var chart = d3.chart.bullet()
+ .width(w - m[1] - m[3])
+ .height(h - m[0] - m[2])
+ .tickFormat(function(d) { return (d / 1e6).toFixed(1); });
+
+var vis = d3.select("body").append("svg:svg")
+ .attr("width", w)
+ .attr("height", h);
+
+var g = vis.append("svg:g")
+ .data([{
+ title: "Revenue",
+ subtitle: "US$, in millions",
+ ranges: [2.1e6, 2.85e6, 4e6],
+ measures: [2.3e6, 3.01e6],
+ markers: [1.15e6, 3.0e6]
+ }])
+ .attr("class", "bullet")
+ .attr("transform", "translate(" + m[3] + "," + m[0] + ")")
+ .call(chart);
+
+g.append("svg:text")
+ .attr("class", "title")
+ .attr("text-anchor", "end")
+ .attr("dx", "-6")
+ .attr("y", chart.height() / 2)
+ .text(function(d) { return d.title; });
+
+g.append("svg:text")
+ .attr("class", "subtitle")
+ .attr("text-anchor", "end")
+ .attr("dx", "-6")
+ .attr("dy", "1em")
+ .attr("y", chart.height() / 2)
+ .text(function(d) { return d.subtitle; });
+
+ </script>
+ </body>
+</html>
View
37 examples/bullet/bullets.js
@@ -0,0 +1,37 @@
+var bullets = [
+ {
+ title: "Revenue",
+ subtitle: "US$, in thousands",
+ ranges: [150, 225, 300],
+ measures: [270],
+ markers: [250]
+ },
+ {
+ title: "Profit",
+ subtitle: "%",
+ ranges: [20, 25, 30],
+ measures: [23],
+ markers: [26]
+ },
+ {
+ title: "Order Size",
+ subtitle: "US$, average",
+ ranges: [350, 500, 600],
+ measures: [320],
+ markers: [550]
+ },
+ {
+ title: "New Customers",
+ subtitle: "count",
+ ranges: [1400, 2000, 2500],
+ measures: [1650],
+ markers: [2100]
+ },
+ {
+ title: "Satisfaction",
+ subtitle: "out of 5",
+ ranges: [3.5, 4.25, 5],
+ measures: [4.7],
+ markers: [4.4]
+ }
+];
View
3  examples/index.html
@@ -9,6 +9,9 @@
<li><a href="albers/albers.html">albers</a></li>
<li><a href="area/area.html">area</a></li>
<li><a href="bar/bar.html">bar</a></li>
+ <li><a href="bullet/bullet.html">bullet</a></li>
+ <li><a href="bullet/bullet-multiples.html">bullet-multiples</a></li>
+ <li><a href="bullet/bullet-randomize.html">bullet-randomize</a></li>
<li><a href="calendar/dji.html">calendar-dji</a></li>
<li><a href="calendar/vix.html">calendar-vix</a></li>
<li><a href="cartogram/cartogram.html">cartogram</a></li>
View
2  src/behavior/zoom.js
@@ -107,7 +107,7 @@ d3.behavior.zoom = function() {
};
function transform(scale, o) {
- var domain = scale.__domain || (scale.__domain = scale.domain());
+ var domain = scale.__domain || (scale.__domain = scale.domain()),
range = scale.range().map(function(v) { return (v - o) / k; });
scale.domain(domain).domain(range.map(scale.invert));
}
View
238 src/chart/bullet.js
@@ -0,0 +1,238 @@
+// ranges (bad, satisfactory, good)
+// measures (actual, forecast)
+// markers (previous, goal)
+
+/*
+ * Chart design based on the recommendations of Stephen Few. Implementation
+ * based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+ * http://projects.instantcognition.com/protovis/bulletchart/
+ */
+
+d3.chart.bullet = function() {
+ var orient = "left", // TODO top & bottom
+ reverse = false,
+ duration = 0,
+ ranges = d3_chart_bulletRanges,
+ markers = d3_chart_bulletMarkers,
+ measures = d3_chart_bulletMeasures,
+ width = 380,
+ height = 30,
+ tickFormat = null;
+
+ // For each small multiple…
+ function bullet(g) {
+ g.each(function(d, i) {
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
+ g = d3.select(this);
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
+ .range(reverse ? [width, 0] : [0, width]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ // Derive width-scales from the x-scales.
+ var w0 = d3_chart_bulletWidth(x0),
+ w1 = d3_chart_bulletWidth(x1);
+
+ // Update the range rects.
+ var range = g.selectAll("rect.range")
+ .data(rangez);
+
+ range.enter().append("svg:rect")
+ .attr("class", function(d, i) { return "range s" + i; })
+ .attr("width", w0)
+ .attr("height", height)
+ .attr("x", reverse ? x0 : 0)
+ .transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("x", reverse ? x1 : 0);
+
+ range.transition()
+ .duration(duration)
+ .attr("x", reverse ? x1 : 0)
+ .attr("width", w1)
+ .attr("height", height);
+
+ // Update the measure rects.
+ var measure = g.selectAll("rect.measure")
+ .data(measurez);
+
+ measure.enter().append("svg:rect")
+ .attr("class", function(d, i) { return "measure s" + i; })
+ .attr("width", w0)
+ .attr("height", height / 3)
+ .attr("x", reverse ? x0 : 0)
+ .attr("y", height / 3)
+ .transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("x", reverse ? x1 : 0);
+
+ measure.transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("height", height / 3)
+ .attr("x", reverse ? x1 : 0)
+ .attr("y", height / 3);
+
+ // Update the marker lines.
+ var marker = g.selectAll("line.marker")
+ .data(markerz);
+
+ marker.enter().append("svg:line")
+ .attr("class", "marker")
+ .attr("x1", x0)
+ .attr("x2", x0)
+ .attr("y1", height / 6)
+ .attr("y2", height * 5 / 6)
+ .transition()
+ .duration(duration)
+ .attr("x1", x1)
+ .attr("x2", x1);
+
+ marker.transition()
+ .duration(duration)
+ .attr("x1", x1)
+ .attr("x2", x1)
+ .attr("y1", height / 6)
+ .attr("y2", height * 5 / 6);
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat(8);
+
+ // Update the tick groups.
+ var tick = g.selectAll("g.tick")
+ .data(x1.ticks(8), format);
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append("svg:g")
+ .attr("class", "tick")
+ .attr("transform", d3_chart_bulletTranslate(x0))
+ .attr("opacity", 1e-6);
+
+ tickEnter.append("svg:line")
+ .attr("y1", height)
+ .attr("y2", height * 7 / 6);
+
+ tickEnter.append("svg:text")
+ .attr("text-anchor", "middle")
+ .attr("dy", "1em")
+ .attr("y", height * 7 / 6)
+ .text(format);
+
+ // Transition the entering ticks to the new scale, x1.
+ tickEnter.transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .attr("opacity", 1);
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = tick.transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .attr("opacity", 1);
+
+ tickUpdate.select("line")
+ .attr("y1", height)
+ .attr("y2", height * 7 / 6);
+
+ tickUpdate.select("text")
+ .attr("y", height * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ tick.exit().transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .attr("opacity", 1e-6)
+ .remove();
+ });
+ }
+
+ // left, right, top, bottom
+ bullet.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == "right" || orient == "bottom";
+ return bullet;
+ };
+
+ bullet.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return bullet;
+ };
+
+ bullet.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return bullet;
+ };
+
+ bullet.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return bullet;
+ };
+
+ bullet.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return bullet;
+ };
+
+ bullet.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return bullet;
+ };
+
+ bullet.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return bullet;
+ };
+
+ bullet.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = x;
+ return bullet;
+ };
+
+ return bullet;
+};
+
+function d3_chart_bulletRanges(d) {
+ return d.ranges;
+}
+
+function d3_chart_bulletMarkers(d) {
+ return d.markers;
+}
+
+function d3_chart_bulletMeasures(d) {
+ return d.measures;
+}
+
+function d3_chart_bulletTranslate(x) {
+ return function(d) {
+ return "translate(" + x(d) + ",0)";
+ };
+}
+
+function d3_chart_bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x0);
+ };
+}
View
1  src/chart/chart.js
@@ -0,0 +1 @@
+d3.chart = {};
View
2  src/core/core.js
@@ -1 +1 @@
-d3 = {version: "1.8.5"}; // semver
+d3 = {version: "1.9.0"}; // semver
View
37 src/core/selection.js
@@ -35,7 +35,6 @@ function d3_selection(groups) {
group = groups[j];
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
- subgroup.parentData = group.parentData;
for (var i = 0, n = group.length; i < n; i++) {
if (node = group[i]) {
subgroup.push(subnode = select(node));
@@ -59,7 +58,6 @@ function d3_selection(groups) {
if (node = group[i]) {
subgroups.push(subgroup = selectAll(node));
subgroup.parentNode = node;
- subgroup.parentData = node.__data__;
}
}
}
@@ -90,7 +88,6 @@ function d3_selection(groups) {
group = groups[j];
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
- subgroup.parentData = group.parentData;
for (var i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i)) {
subgroup.push(node);
@@ -130,13 +127,8 @@ function d3_selection(groups) {
node,
nodeData;
- function enterNode(data) {
- return {__data__: data};
- }
-
if (join) {
var nodeByKey = {},
- exitData = [],
keys = [],
key,
j = groupData.length;
@@ -144,11 +136,11 @@ function d3_selection(groups) {
for (i = 0; i < n; i++) {
key = join.call(node = group[i], node.__data__, i);
if (key in nodeByKey) {
- exitNodes[j++] = group[i];
+ exitNodes[j++] = group[i]; // duplicate key
} else {
nodeByKey[key] = node;
- keys.push(key);
}
+ keys.push(key);
}
for (i = 0; i < m; i++) {
@@ -158,7 +150,7 @@ function d3_selection(groups) {
updateNodes[i] = node;
enterNodes[i] = exitNodes[i] = null;
} else {
- enterNodes[i] = enterNode(nodeData),
+ enterNodes[i] = d3_selection_enterNode(nodeData);
updateNodes[i] = exitNodes[i] = null;
}
delete nodeByKey[key];
@@ -178,12 +170,12 @@ function d3_selection(groups) {
updateNodes[i] = node;
enterNodes[i] = exitNodes[i] = null;
} else {
- enterNodes[i] = enterNode(nodeData);
+ enterNodes[i] = d3_selection_enterNode(nodeData);
updateNodes[i] = exitNodes[i] = null;
}
}
for (; i < m; i++) {
- enterNodes[i] = enterNode(groupData[i]);
+ enterNodes[i] = d3_selection_enterNode(groupData[i]);
updateNodes[i] = exitNodes[i] = null;
}
for (; i < n1; i++) {
@@ -197,11 +189,6 @@ function d3_selection(groups) {
= exitNodes.parentNode
= group.parentNode;
- enterNodes.parentData
- = updateNodes.parentData
- = exitNodes.parentData
- = group.parentData;
-
enter.push(enterNodes);
update.push(updateNodes);
exit.push(exitNodes);
@@ -212,7 +199,7 @@ function d3_selection(groups) {
group;
if (typeof data == "function") {
while (++i < n) {
- bind(group = groups[i], data.call(group, group.parentData, i));
+ bind(group = groups[i], data.call(group, group.parentNode.__data__, i));
}
} else {
while (++i < n) {
@@ -510,10 +497,9 @@ function d3_selection(groups) {
// TODO remove(node)?
// TODO remove(function)?
groups.remove = function() {
- return select(function(node) {
- var parent = node.parentNode;
- parent.removeChild(node);
- return parent;
+ return groups.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
});
};
@@ -583,7 +569,6 @@ function d3_selectionEnter(groups) {
group = groups[j];
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
- subgroup.parentData = group.parentData;
for (var i = 0, n = group.length; i < n; i++) {
if (node = group[i]) {
subgroup.push(subnode = select(group.parentNode));
@@ -642,3 +627,7 @@ function d3_selection_comparator(comparator) {
return comparator(a && a.__data__, b && b.__data__);
};
}
+
+function d3_selection_enterNode(data) {
+ return {__data__: data};
+}
Please sign in to comment.
Something went wrong with that request. Please try again.