Skip to content
Browse files

Add treemap example. Update to 1.5.0.

  • Loading branch information...
1 parent 3f9b542 commit 1cfaa24af56ffac3a0ee9c9b078ab267b38cd07d @mbostock mbostock committed Mar 3, 2011
View
21 _includes/Makefile
@@ -27,7 +27,9 @@ EX_FILES = \
../ex/dji.js \
../ex/force.css \
../ex/force.js \
- ../ex/force_layout.js \
+ ../ex/flare.json \
+ ../ex/treemap.css \
+ ../ex/treemap.js \
../ex/miserables.json \
../ex/splom.css \
../ex/splom.js \
@@ -50,6 +52,7 @@ INCLUDE_FILES = \
choropleth.js \
dji.js \
force.js \
+ treemap.js \
splom.js \
cross.js \
stream.js \
@@ -123,10 +126,6 @@ $(SRC_FILES):
@rm -rf $@
git cat-file blob master:examples/force/force.js > $@
-../ex/force_layout.js:
- @rm -rf $@
- git cat-file blob master:examples/force/layout.js >> $@
-
../ex/force.css:
@rm -rf $@
git cat-file blob master:examples/force/force.css > $@
@@ -135,6 +134,18 @@ $(SRC_FILES):
@rm -rf $@
git cat-file blob master:examples/force/miserables.json > $@
+../ex/treemap.js treemap.js:
+ @rm -rf $@
+ git cat-file blob master:examples/treemap/treemap.js > $@
+
+../ex/treemap.css:
+ @rm -rf $@
+ git cat-file blob master:examples/treemap/treemap.css > $@
+
+../ex/flare.json:
+ @rm -rf $@
+ git cat-file blob master:examples/treemap/flare.json > $@
+
../ex/splom.js splom.js:
@rm -rf $@
git cat-file blob master:examples/splom/splom.js > $@
View
4 _includes/force.js
@@ -8,10 +8,10 @@ var vis = d3.select("#chart")
.attr("height", h);
d3.json("miserables.json", function(json) {
- var force = layout_force()
+ var force = d3.layout.force()
.nodes(json.nodes)
.links(json.links)
- .size({x: w, y: h})
+ .size([w, h])
.start();
var link = vis.selectAll("line.link")
View
26 _includes/treemap.js
@@ -0,0 +1,26 @@
+var w = 960,
+ h = 500,
+ color = d3.scale.category20c();
+
+var treemap = d3.layout.treemap()
+ .size([w, h])
+ .children(function(d, i) { return typeof d.value == "object" && d3.entries(d.value); })
+ .value(function(d) { return d.value; });
+
+var div = d3.select("#chart").append("div")
+ .style("position", "relative")
+ .style("width", w + "px")
+ .style("height", h + "px");
+
+d3.json("flare.json", function(json) {
+ div.data(d3.entries(json)).selectAll("div")
+ .data(treemap)
+ .enter().append("div")
+ .attr("class", "cell")
+ .style("background", function(d) { return d.children ? color(d.data.key) : null; })
+ .style("left", function(d) { return d.x + "px"; })
+ .style("top", function(d) { return d.y + "px"; })
+ .style("width", function(d) { return d.dx - 1 + "px"; })
+ .style("height", function(d) { return d.dy - 1 + "px"; })
+ .text(function(d) { return d.children ? null : d.data.key; });
+});
View
6 _layouts/api.html
@@ -3,11 +3,11 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
- <script type="text/javascript" src="../d3.js?1.2.1"></script>
+ <script type="text/javascript" src="../d3.js?1.5.0"></script>
<style type="text/css">
-@import url("../style.css?1.2.1");
-@import url("../syntax.css?1.2.1");
+@import url("../style.css?1.5.0");
+@import url("../syntax.css?1.5.0");
</style>
</head>
View
6 _layouts/default.html
@@ -3,11 +3,11 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
- <script type="text/javascript" src="d3.js?1.2.1"></script>
+ <script type="text/javascript" src="d3.js?1.5.0"></script>
<style type="text/css">
-@import url("style.css?1.2.1");
-@import url("syntax.css?1.2.1");
+@import url("style.css?1.5.0");
+@import url("syntax.css?1.5.0");
</style>
</head>
View
6 _layouts/ex.html
@@ -3,11 +3,11 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
- <script type="text/javascript" src="../d3.js?1.2.1"></script>
+ <script type="text/javascript" src="../d3.js?1.5.0"></script>
<style type="text/css">
-@import url("../style.css?1.2.1");
-@import url("../syntax.css?1.2.1");
+@import url("../style.css?1.5.0");
+@import url("../syntax.css?1.5.0");
</style>
</head>
View
6 _layouts/tutorial.html
@@ -3,11 +3,11 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
- <script type="text/javascript" src="../d3.js?1.2.1"></script>
+ <script type="text/javascript" src="../d3.js?1.5.0"></script>
<style type="text/css">
-@import url("../style.css?1.2.1");
-@import url("../syntax.css?1.2.1");
+@import url("../style.css?1.5.0");
+@import url("../syntax.css?1.5.0");
</style>
</head>
View
16 api/index.markdown
@@ -43,7 +43,7 @@ title: Documentation
ascending, descending, min, max, keys, values, entries, split, merge, range,
xhr, text, json, html, xml, format, nest (map, key, sortKeys, sortValues,
-rollup), ns, event, rgb, hsl, ease, interpolate, interpolateNumber,
+rollup, entries), ns, event, rgb, hsl, ease, interpolate, interpolateNumber,
interpolateRound, interpolateString, interpolateRgb, interpolateArray,
interpolateObject.
@@ -69,26 +69,28 @@ category20b, category20c, quantile (quantiles), quantize.
mouse, arc (innerRadius, outerRadius, startAngle, endAngle), line (x, y,
interpolate, tension) area, (x, y0, y1, interpolate, tension), chord (radius,
-source, target, startAngle, endAngle)
+source, target, startAngle, endAngle).
### d3.time
-format (format, parse, toString)
+format (format, parse, toString).
### d3.layout
chord (matrix, padding, sortGroups, sortSubgroups, sortChords, chords, groups),
-stack (order, offset)
+stack (order, offset), force (on, nodes, links, size, distance, start, stop,
+resume, drag), pie (value, sort, startAngle, endAngle), treemap (children,
+value, size, round).
### d3.geom
-contour, hull, voronoi, delaunay, quadtree, polygon (area, clip)
+contour, hull, voronoi, delaunay, quadtree, polygon (area, clip).
### d3.geo
albers (origin, parallels, scale, translate), albersUsa (scale, translate),
-mercator (scale, translate), path (projection, area, pointRadius)
+mercator (scale, translate), path (projection, area, pointRadius).
### d3.csv
-parse, parseRows, format
+parse, parseRows, format.
View
57 d3.js
@@ -1,4 +1,4 @@
-(function(){d3 = {version: "1.3.0"}; // semver
+(function(){d3 = {version: "1.5.0"}; // semver
if (!Date.now) Date.now = function() {
return +new Date();
};
@@ -73,55 +73,74 @@ d3.nest = function() {
sortValues,
rollup;
- function recurse(j, array) {
- if (j >= keys.length) return rollup
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup
? rollup.call(nest, array) : (sortValues
? array.sort(sortValues)
: array);
var i = -1,
n = array.length,
- key = keys[j],
+ key = keys[depth++],
keyValue,
- keyValues = [],
- sortKey = sortKeys[j],
object,
- map = {};
+ o = {};
while (++i < n) {
- if ((keyValue = key(object = array[i])) in map) {
- map[keyValue].push(object);
+ if ((keyValue = key(object = array[i])) in o) {
+ o[keyValue].push(object);
} else {
- map[keyValue] = [object];
- keyValues.push(keyValue);
+ o[keyValue] = [object];
}
}
- j++;
- i = -1;
- n = keyValues.length;
- while (++i < n) {
- object = map[keyValue = keyValues[i]];
- map[keyValue] = recurse(j, object);
+ for (keyValue in o) {
+ o[keyValue] = map(o[keyValue], depth);
}
- return map;
+ return o;
+ }
+
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+
+ var a = [],
+ sortKey = sortKeys[depth++],
+ key;
+
+ for (key in map) {
+ a.push({key: key, values: entries(map[key], depth)});
+ }
+
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+
+ return a;
}
nest.map = function(array) {
- return recurse(0, array);
+ return map(array, 0);
+ };
+
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
};
nest.key = function(d) {
keys.push(d);
return nest;
};
+ // Specifies the order for the most-recently specified key.
+ // Note: only applies to entries. Map keys are unordered!
nest.sortKeys = function(order) {
sortKeys[keys.length - 1] = order;
return nest;
};
+ // Specifies the order for leaf values.
+ // Applies to both maps and entries array.
nest.sortValues = function(order) {
sortValues = order;
return nest;
View
375 d3.layout.js
@@ -150,6 +150,200 @@ d3.layout.chord = function() {
return chord;
};
+// A rudimentary force layout using Gauss-Seidel.
+d3.layout.force = function() {
+ var force = {},
+ event = d3.dispatch("tick"),
+ size = [1, 1],
+ alpha = .5,
+ distance = 30,
+ interval,
+ nodes,
+ links,
+ distances;
+
+ function tick() {
+ var n = distances.length,
+ i, // current index
+ o, // current link
+ s, // current source
+ t, // current target
+ l, // current distance
+ x, // x-distance
+ y; // y-distance
+
+ // gauss-seidel relaxation
+ for (i = 0; i < n; ++i) {
+ o = distances[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = Math.sqrt(x * x + y * y)) {
+ l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l;
+ x *= l;
+ y *= l;
+ if (s.fixed) {
+ if (t.fixed) continue;
+ t.x -= x;
+ t.y -= y;
+ } else if (t.fixed) {
+ s.x += x;
+ s.y += y;
+ } else {
+ s.x += x;
+ s.y += y;
+ t.x -= x;
+ t.y -= y;
+ }
+ }
+ }
+
+ // simulated annealing, basically
+ if ((alpha *= .99) < 1e-6) force.stop();
+
+ event.tick.dispatch({type: "tick"});
+ }
+
+ force.on = function(type, listener) {
+ event[type].add(listener);
+ return force;
+ };
+
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+
+ force.distance = function(d) {
+ if (!arguments.length) return distance;
+ distance = d;
+ return force;
+ };
+
+ force.start = function() {
+ var i,
+ j,
+ k,
+ n = nodes.length,
+ m = links.length,
+ w = size[0],
+ h = size[1],
+ o;
+
+ var paths = [];
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ o.x = o.x || Math.random() * w;
+ o.y = o.y || Math.random() * h;
+ o.fixed = 0;
+ paths[i] = [];
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Infinity;
+ }
+ paths[i][i] = 0;
+ }
+
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ paths[o.source][o.target] = 1;
+ paths[o.target][o.source] = 1;
+ o.source = nodes[o.source];
+ o.target = nodes[o.target];
+ }
+
+ // Floyd-Warshall
+ for (k = 0; k < n; ++k) {
+ for (i = 0; i < n; ++i) {
+ for (j = 0; j < n; ++j) {
+ paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]);
+ }
+ }
+ }
+
+ distances = [];
+ for (i = 0; i < n; ++i) {
+ for (j = i + 1; j < n; ++j) {
+ distances.push({
+ source: nodes[i],
+ target: nodes[j],
+ distance: paths[i][j] * paths[i][j]
+ });
+ }
+ }
+
+ distances.sort(function(a, b) {
+ return a.distance - b.distance;
+ });
+
+ if (interval) clearInterval(interval);
+ interval = setInterval(tick, 24);
+ return force;
+ };
+
+ force.resume = function() {
+ alpha = .1;
+ if (!interval) interval = setInterval(tick, 24);
+ return force;
+ };
+
+ force.stop = function() {
+ interval = clearInterval(interval);
+ return force;
+ };
+
+ // use `node.call(force.drag)` to make nodes draggable
+ force.drag = function() {
+ var node, element;
+
+ this
+ .on("mouseover", function(d) { d.fixed = true; })
+ .on("mouseout", function(d) { if (d != node) d.fixed = false; })
+ .on("mousedown", mousedown);
+
+ d3.select(window)
+ .on("mousemove", mousemove)
+ .on("mouseup", mouseup);
+
+ function mousedown(d) {
+ (node = d).fixed = true;
+ element = this;
+ d3.event.preventDefault();
+ }
+
+ function mousemove() {
+ if (!node) return;
+ var m = d3.svg.mouse(element);
+ node.x = m[0];
+ node.y = m[1];
+ force.resume(); // restart annealing
+ }
+
+ function mouseup() {
+ if (!node) return;
+ mousemove();
+ node.fixed = false;
+ node = element = null;
+ }
+
+ return force;
+ };
+
+ return force;
+};
d3.layout.pie = function() {
var value = Number,
sort = null,
@@ -407,4 +601,185 @@ function d3_layout_stackMaxIndex(array) {
function d3_layout_stackSum(p, d) {
return p + d.y;
}
+// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
+d3.layout.treemap = function() {
+ var children = d3_layout_treemapChildren,
+ value = d3_layout_treemapValue,
+ round = Math.round,
+ size = [1, 1]; // width, height
+
+ // Recursively compute the node depth and value.
+ // Also converts the data representation into a standard tree structure.
+ // Also sorts child nodes by descending value to optimize squarification.
+ function sum(data, depth, nodes) {
+ var datas = children.call(treemap, data, depth),
+ node = {depth: depth, data: data};
+ nodes.push(node);
+ if (datas) {
+ var i = -1,
+ n = datas.length,
+ c = node.children = [],
+ v = 0,
+ j = depth + 1;
+ while (++i < n) {
+ d = sum(datas[i], j, nodes);
+ if (d.value > 0) { // ignore NaN, negative, etc.
+ c.push(d);
+ v += d.value;
+ }
+ }
+ node.value = v;
+ } else {
+ node.value = value.call(treemap, data, depth);
+ }
+ if (!depth) scale(node, size[0] * size[1] / node.value); // root
+ return node;
+ }
+
+ // Recursively compute the node area based on value & scale.
+ function scale(node, k) {
+ var children = node.children;
+ node.area = node.value * k;
+ if (children) {
+ var i = -1,
+ n = children.length;
+ while (++i < n) scale(children[i], k);
+ }
+ }
+
+ // Recursively arranges the specified node's children into squarified rows.
+ function squarify(node) {
+ if (!node.children) return;
+ var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy},
+ row = [],
+ children = node.children.slice().sort(d3_layout_treemapSort),
+ child,
+ best = Infinity, // the best row score so far
+ score, // the current row score
+ u = Math.min(rect.dx, rect.dy), // initial orientation
+ n;
+ row.area = 0;
+ while ((n = children.length) > 0) {
+ row.push(child = children[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) { // continue with this orientation
+ children.pop();
+ best = score;
+ } else { // abort, and try a different orientation
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ node.children.forEach(squarify);
+ }
+
+ // Computes the score for the specified row, as the worst aspect ratio.
+ function worst(row, u) {
+ var s = row.area,
+ r,
+ rmax = 0,
+ rmin = Infinity,
+ i = -1,
+ n = row.length;
+ while (++i < n) {
+ r = row[i].area;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return Math.max((u * rmax) / s, s / (u * rmin));
+ }
+
+ // Positions the specified row of nodes. Modifies `rect`.
+ function position(row, u, rect, flush) {
+ var i = -1,
+ n = row.length,
+ x = rect.x,
+ y = rect.y,
+ v = u ? round(row.area / u) : 0,
+ o;
+ if (u == rect.dx) { // horizontal subdivision
+ if (flush || v > rect.dy) v = rect.dy; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = round(o.area / v);
+ }
+ o.dx += rect.x + rect.dx - x; // rounding error
+ rect.y += v;
+ rect.dy -= v;
+ } else { // vertical subdivision
+ if (flush || v > rect.dx) v = rect.dx; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = round(o.area / v);
+ }
+ o.dy += rect.y + rect.dy - y; // rounding error
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+
+ function treemap(d) {
+ var nodes = [],
+ root = sum(d, 0, nodes);
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ squarify(root);
+ return nodes;
+ }
+
+ treemap.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return treemap;
+ };
+
+ treemap.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return treemap;
+ };
+
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+
+ return treemap;
+};
+
+function d3_layout_treemapChildren(d) {
+ return d.children;
+}
+
+function d3_layout_treemapValue(d) {
+ return d.value;
+}
+
+function d3_layout_treemapSort(a, b) {
+ return b.area - a.area;
+}
})()
View
21 d3.layout.min.js
@@ -1,7 +1,14 @@
-(function(){function A(a){return a.reduce(B,0)}function C(a){for(var j=1,f=0,c=a[0].y,i,e=a.length;j<e;++j)if((i=a[j].y)>c){f=j;c=i}return f}function B(a,j){return a+j.y}d3.layout={};d3.layout.chord=function(){function a(){var g={},l=[],t=d3.range(b),q=[],r,n,w,o,s;c=[];i=[];r=0;for(o=-1;++o<b;){n=0;for(s=-1;++s<b;)n+=e[o][s];l.push(n);q.push(d3.range(b));r+=n}k&&t.sort(function(x,u){return k(l[x],l[u])});m&&q.forEach(function(x,u){x.sort(function(D,E){return m(e[u][D],e[u][E])})});r=(2*Math.PI-h*
-b)/r;n=0;for(o=-1;++o<b;){w=n;for(s=-1;++s<b;){var v=t[o],y=q[o][s],z=e[v][y];g[v+"-"+y]={index:v,subindex:y,startAngle:n,endAngle:n+=z*r,value:z}}i.push({index:v,startAngle:w,endAngle:n,value:(n-w)/r});n+=h}for(o=-1;++o<b;)for(s=o-1;++s<b;){t=g[o+"-"+s];q=g[s+"-"+o];if(t.value||q.value)c.push({source:t,target:q})}p&&j()}function j(){c.sort(function(g,l){g=Math.min(g.source.value,g.target.value);l=Math.min(l.source.value,l.target.value);return p(g,l)})}var f={},c,i,e,b,h=0,k,m,p;f.matrix=function(g){if(!arguments.length)return e;
-b=(e=g)&&e.length;c=i=null;return f};f.padding=function(g){if(!arguments.length)return h;h=g;c=i=null;return f};f.sortGroups=function(g){if(!arguments.length)return k;k=g;c=i=null;return f};f.sortSubgroups=function(g){if(!arguments.length)return m;m=g;c=null;return f};f.sortChords=function(g){if(!arguments.length)return p;p=g;c&&j();return f};f.chords=function(){c||a();return c};f.groups=function(){i||a();return i};return f};d3.layout.pie=function(){function a(e){var b=+(typeof c=="function"?c.apply(this,
-arguments):c),h=(typeof i=="function"?i.apply(this,arguments):i)-c,k=d3.range(e.length);f!=null&&k.sort(function(g,l){return f(e[g],e[l])});var m=e.map(j);h/=m.reduce(function(g,l){return g+l},0);var p=k.map(function(g){return{value:d=m[g],startAngle:b,endAngle:b+=d*h}});return e.map(function(g,l){return p[k[l]]})}var j=Number,f=null,c=0,i=2*Math.PI;a.value=function(e){if(!arguments.length)return j;j=e;return a};a.sort=function(e){if(!arguments.length)return f;f=e;return a};a.startAngle=function(e){if(!arguments.length)return c;
-c=e;return a};a.endAngle=function(e){if(!arguments.length)return i;i=e;return a};return a};d3.layout.stack=function(){function a(c){var i=c.length,e=c[0].length,b,h,k,m=F[j](c);G[f](c,m);for(h=0;h<e;++h){b=1;for(k=c[m[0]][h].y0;b<i;++b)c[m[b]][h].y0=k+=c[m[b-1]][h].y}return c}var j="default",f="zero";a.order=function(c){if(!arguments.length)return j;j=c;return a};a.offset=function(c){if(!arguments.length)return f;f=c;return a};return a};var F={"inside-out":function(a){var j=a.length,f,c=a.map(C),
-i=a.map(A),e=d3.range(j).sort(function(p,g){return c[p]-c[g]}),b=0,h=0,k=[],m=[];for(a=0;a<j;a++){f=e[a];if(b<h){b+=i[f];k.push(f)}else{h+=i[f];m.push(f)}}return m.reverse().concat(k)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},G={silhouette:function(a,j){var f=a.length,c=a[0].length,i=[],e=0,b,h,k;for(h=0;h<c;++h){for(k=b=0;b<f;b++)k+=a[b][h].y;if(k>e)e=k;i.push(k)}h=0;for(b=j[0];h<c;++h)a[b][h].y0=(e-i[h])/2},wiggle:function(a,j){var f=
-a.length,c=a[0],i=c.length,e,b,h,k,m,p=j[0],g,l,t,q,r,n;a[p][0].y0=r=n=0;for(b=1;b<i;++b){for(g=e=0;e<f;++e)g+=a[e][b].y;l=e=0;for(q=c[b].x-c[b-1].x;e<f;++e){h=0;k=j[e];for(t=(a[k][b].y-a[k][b-1].y)/(2*q);h<e;++h)t+=(a[m=j[h]][b].y-a[m][b-1].y)/q;l+=t*a[k][b].y}a[p][b].y0=r-=g?l/g*q:0;if(r<n)n=r}for(b=0;b<i;++b)a[p][b].y0-=n},zero:function(a,j){for(var f=0,c=a[0].length,i=j[0];f<c;++f)a[i][f].y0=0}}})();
+(function(){function A(c){return c.reduce(B,0)}function C(c){for(var h=1,n=0,i=c[0].y,o,l=c.length;h<l;++h)if((o=c[h].y)>i){n=h;i=o}return n}function B(c,h){return c+h.y}function D(c){return c.children}function E(c){return c.value}function F(c,h){return h.area-c.area}d3.layout={};d3.layout.chord=function(){function c(){var a={},j=[],f=d3.range(g),s=[],t,k,q,r,u;i=[];o=[];t=0;for(r=-1;++r<g;){k=0;for(u=-1;++u<g;)k+=l[r][u];j.push(k);s.push(d3.range(g));t+=k}p&&f.sort(function(y,x){return p(j[y],j[x])});
+e&&s.forEach(function(y,x){y.sort(function(G,H){return e(l[x][G],l[x][H])})});t=(2*Math.PI-m*g)/t;k=0;for(r=-1;++r<g;){q=k;for(u=-1;++u<g;){var v=f[r],w=s[r][u],z=l[v][w];a[v+"-"+w]={index:v,subindex:w,startAngle:k,endAngle:k+=z*t,value:z}}o.push({index:v,startAngle:q,endAngle:k,value:(k-q)/t});k+=m}for(r=-1;++r<g;)for(u=r-1;++u<g;){f=a[r+"-"+u];s=a[u+"-"+r];if(f.value||s.value)i.push({source:f,target:s})}b&&h()}function h(){i.sort(function(a,j){a=Math.min(a.source.value,a.target.value);j=Math.min(j.source.value,
+j.target.value);return b(a,j)})}var n={},i,o,l,g,m=0,p,e,b;n.matrix=function(a){if(!arguments.length)return l;g=(l=a)&&l.length;i=o=null;return n};n.padding=function(a){if(!arguments.length)return m;m=a;i=o=null;return n};n.sortGroups=function(a){if(!arguments.length)return p;p=a;i=o=null;return n};n.sortSubgroups=function(a){if(!arguments.length)return e;e=a;i=null;return n};n.sortChords=function(a){if(!arguments.length)return b;b=a;i&&h();return n};n.chords=function(){i||c();return i};n.groups=
+function(){o||c();return o};return n};d3.layout.force=function(){function c(){var b=e.length,a,j,f,s,t,k,q;for(a=0;a<b;++a){j=e[a];f=j.source;s=j.target;k=s.x-f.x;q=s.y-f.y;if(t=Math.sqrt(k*k+q*q)){t=o/(j.distance*j.distance)*(t-l*j.distance)/t;k*=t;q*=t;if(f.fixed){if(!s.fixed){s.x-=k;s.y-=q}}else if(s.fixed){f.x+=k;f.y+=q}else{f.x+=k;f.y+=q;s.x-=k;s.y-=q}}}if((o*=0.99)<1.0E-6)h.stop();n.tick.dispatch({type:"tick"})}var h={},n=d3.dispatch("tick"),i=[1,1],o=0.5,l=30,g,m,p,e;h.on=function(b,a){n[b].add(a);
+return h};h.nodes=function(b){if(!arguments.length)return m;m=b;return h};h.links=function(b){if(!arguments.length)return p;p=b;return h};h.size=function(b){if(!arguments.length)return i;i=b;return h};h.distance=function(b){if(!arguments.length)return l;l=b;return h};h.start=function(){var b,a,j,f=m.length;j=p.length;var s=i[0],t=i[1],k=[];for(b=0;b<f;++b){a=m[b];a.x=a.x||Math.random()*s;a.y=a.y||Math.random()*t;a.fixed=0;k[b]=[];for(a=0;a<f;++a)k[b][a]=Infinity;k[b][b]=0}for(b=0;b<j;++b){a=p[b];
+k[a.source][a.target]=1;k[a.target][a.source]=1;a.source=m[a.source];a.target=m[a.target]}for(j=0;j<f;++j)for(b=0;b<f;++b)for(a=0;a<f;++a)k[b][a]=Math.min(k[b][a],k[b][j]+k[j][a]);e=[];for(b=0;b<f;++b)for(a=b+1;a<f;++a)e.push({source:m[b],target:m[a],distance:k[b][a]*k[b][a]});e.sort(function(q,r){return q.distance-r.distance});g&&clearInterval(g);g=setInterval(c,24);return h};h.resume=function(){o=0.1;g||(g=setInterval(c,24));return h};h.stop=function(){g=clearInterval(g);return h};h.drag=function(){function b(){if(a){var f=
+d3.svg.mouse(j);a.x=f[0];a.y=f[1];h.resume()}}var a,j;this.on("mouseover",function(f){f.fixed=true}).on("mouseout",function(f){if(f!=a)f.fixed=false}).on("mousedown",function(f){(a=f).fixed=true;j=this;d3.event.preventDefault()});d3.select(window).on("mousemove",b).on("mouseup",function(){if(a){b();a.fixed=false;a=j=null}});return h};return h};d3.layout.pie=function(){function c(l){var g=+(typeof i=="function"?i.apply(this,arguments):i),m=(typeof o=="function"?o.apply(this,arguments):o)-i,p=d3.range(l.length);
+n!=null&&p.sort(function(a,j){return n(l[a],l[j])});var e=l.map(h);m/=e.reduce(function(a,j){return a+j},0);var b=p.map(function(a){return{value:d=e[a],startAngle:g,endAngle:g+=d*m}});return l.map(function(a,j){return b[p[j]]})}var h=Number,n=null,i=0,o=2*Math.PI;c.value=function(l){if(!arguments.length)return h;h=l;return c};c.sort=function(l){if(!arguments.length)return n;n=l;return c};c.startAngle=function(l){if(!arguments.length)return i;i=l;return c};c.endAngle=function(l){if(!arguments.length)return o;
+o=l;return c};return c};d3.layout.stack=function(){function c(i){var o=i.length,l=i[0].length,g,m,p,e=I[h](i);J[n](i,e);for(m=0;m<l;++m){g=1;for(p=i[e[0]][m].y0;g<o;++g)i[e[g]][m].y0=p+=i[e[g-1]][m].y}return i}var h="default",n="zero";c.order=function(i){if(!arguments.length)return h;h=i;return c};c.offset=function(i){if(!arguments.length)return n;n=i;return c};return c};var I={"inside-out":function(c){var h=c.length,n,i=c.map(C),o=c.map(A),l=d3.range(h).sort(function(b,a){return i[b]-i[a]}),g=0,
+m=0,p=[],e=[];for(c=0;c<h;c++){n=l[c];if(g<m){g+=o[n];p.push(n)}else{m+=o[n];e.push(n)}}return e.reverse().concat(p)},reverse:function(c){return d3.range(c.length).reverse()},"default":function(c){return d3.range(c.length)}},J={silhouette:function(c,h){var n=c.length,i=c[0].length,o=[],l=0,g,m,p;for(m=0;m<i;++m){for(p=g=0;g<n;g++)p+=c[g][m].y;if(p>l)l=p;o.push(p)}m=0;for(g=h[0];m<i;++m)c[g][m].y0=(l-o[m])/2},wiggle:function(c,h){var n=c.length,i=c[0],o=i.length,l,g,m,p,e,b=h[0],a,j,f,s,t,k;c[b][0].y0=
+t=k=0;for(g=1;g<o;++g){for(a=l=0;l<n;++l)a+=c[l][g].y;j=l=0;for(s=i[g].x-i[g-1].x;l<n;++l){m=0;p=h[l];for(f=(c[p][g].y-c[p][g-1].y)/(2*s);m<l;++m)f+=(c[e=h[m]][g].y-c[e][g-1].y)/s;j+=f*c[p][g].y}c[b][g].y0=t-=a?j/a*s:0;if(t<k)k=t}for(g=0;g<o;++g)c[b][g].y0-=k},zero:function(c,h){for(var n=0,i=c[0].length,o=h[0];n<i;++n)c[o][n].y0=0}};d3.layout.treemap=function(){function c(e,b,a){var j=l.call(o,e,b),f={depth:b,data:e};a.push(f);if(j){e=-1;for(var s=j.length,t=f.children=[],k=0,q=b+1;++e<s;){d=c(j[e],
+q,a);if(d.value>0){t.push(d);k+=d.value}}f.value=k}else f.value=g.call(o,e,b);b||h(f,p[0]*p[1]/f.value);return f}function h(e,b){var a=e.children;e.area=e.value*b;if(a)for(var j=-1,f=a.length;++j<f;)h(a[j],b)}function n(e){if(e.children){var b={x:e.x,y:e.y,dx:e.dx,dy:e.dy},a=[],j=e.children.slice().sort(F),f,s=Infinity,t=Math.min(b.dx,b.dy);for(a.area=0;(f=j.length)>0;){a.push(f=j[f-1]);a.area+=f.area;f=t;for(var k=a.area,q=void 0,r=0,u=Infinity,v=-1,w=a.length;++v<w;){q=a[v].area;if(q<u)u=q;if(q>
+r)r=q}k*=k;f*=f;if((f=Math.max(f*r/k,k/(f*u)))<=s){j.pop();s=f}else{a.area-=a.pop().area;i(a,t,b,false);t=Math.min(b.dx,b.dy);a.length=a.area=0;s=Infinity}}if(a.length){i(a,t,b,true);a.length=a.area=0}e.children.forEach(n)}}function i(e,b,a,j){var f=-1,s=e.length,t=a.x,k=a.y,q=b?m(e.area/b):0,r;if(b==a.dx){if(j||q>a.dy)q=a.dy;for(;++f<s;){r=e[f];r.x=t;r.y=k;r.dy=q;t+=r.dx=m(r.area/q)}r.dx+=a.x+a.dx-t;a.y+=q;a.dy-=q}else{if(j||q>a.dx)q=a.dx;for(;++f<s;){r=e[f];r.x=t;r.y=k;r.dx=q;k+=r.dy=m(r.area/q)}r.dy+=
+a.y+a.dy-k;a.x+=q;a.dx-=q}}function o(e){var b=[];e=c(e,0,b);e.x=0;e.y=0;e.dx=p[0];e.dy=p[1];n(e);return b}var l=D,g=E,m=Math.round,p=[1,1];o.children=function(e){if(!arguments.length)return l;l=e;return o};o.value=function(e){if(!arguments.length)return g;g=e;return o};o.size=function(e){if(!arguments.length)return p;p=e;return o};o.round=function(e){if(!arguments.length)return m!=Number;m=e?Math.round:Number;return o};return o}})();
View
83 d3.min.js
@@ -25,44 +25,45 @@ a)})}function Ia(a,b){var d=Date.now(),g=false,e=d+b,c=F;if(isFinite(b)){for(;c;
function Ma(a){return a.outerRadius}function ja(a){return a.startAngle}function ka(a){return a.endAngle}function $(a,b,d,g){var e=[],c=-1,f=b.length,h=typeof d=="function",i=typeof g=="function",k;if(h&&i)for(;++c<f;)e.push([d.call(a,k=b[c],c),g.call(a,k,c)]);else if(h)for(;++c<f;)e.push([d.call(a,b[c],c),g]);else if(i)for(;++c<f;)e.push([d,g.call(a,b[c],c)]);else for(;++c<f;)e.push([d,g]);return e}function la(a){return a[0]}function ma(a){return a[1]}function H(a){var b=[],d=0,g=a.length,e=a[0];
for(b.push(e[0],",",e[1]);++d<g;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function na(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return H(a);var d=a.length!=b.length,g="",e=a[0],c=a[1],f=b[0],h=f,i=1;if(d){g+="Q"+(c[0]-f[0]*2/3)+","+(c[1]-f[1]*2/3)+","+c[0]+","+c[1];e=a[1];i=2}if(b.length>1){h=b[1];c=a[i];i++;g+="C"+(e[0]+f[0])+","+(e[1]+f[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,i++){c=a[i];h=b[e];g+="S"+(c[0]-h[0])+","+(c[1]-h[1])+
","+c[0]+","+c[1]}}if(d){d=a[i];g+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return g}function oa(a,b){for(var d=[],g=(1-b)/2,e=a[0],c=a[1],f=a[2],h=2,i=a.length;++h<i;){d.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);e=c;c=f;f=a[h]}d.push([g*(f[0]-e[0]),g*(f[1]-e[1])]);return d}function B(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a,b,d){a.push("C",B(pa,b),",",B(pa,d),",",B(qa,b),",",B(qa,d),",",B(M,b),",",B(M,d))}function Na(){return 0}function Oa(a){return a.source}function Pa(a){return a.target}
-function Qa(a){return a.radius}function Ra(){return 64}function Sa(){return"circle"}d3={version:"1.3.0"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};var N=function(a){return Array.prototype.slice.call(a)};try{N(document.documentElement.childNodes)}catch(eb){N=ua}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 d=0,g=a.length,e=a[0],
-c;if(arguments.length==1)for(;++d<g;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<g;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,g=a.length,e=a[0],c;if(arguments.length==1)for(;++d<g;){if(e<(c=a[d]))e=c}else for(e=b(e);++d<g;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(c,f){if(c>=d.length)return e?e.call(b,f):g?f.sort(g):f;for(var h=-1,i=f.length,k=d[c],j,o=[],p,m={};++h<i;)if((j=k(p=f[h]))in m)m[j].push(p);else{m[j]=[p];o.push(j)}c++;h=-1;for(i=o.length;++h<i;){p=m[j=
-o[h]];m[j]=a(c,p)}return m}var b={},d=[],g,e;b.map=function(c){return a(0,c)};b.key=function(c){d.push(c);return b};b.sortKeys=function(){return b};b.sortValues=function(c){g=c;return b};b.rollup=function(c){e=c;return b};return b};d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],
-a)};d3.split=function(a,b){var d=[],g=[],e,c=-1,f=a.length;if(arguments.length<2)b=va;for(;++c<f;)if(b.call(g,e=a[c],c))g=[];else{g.length||d.push(g);g.push(e)}return d};d3.range=function(a,b,d){if(arguments.length==1){b=a;a=0}if(d==null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var g=[],e=-1,c;if(d<0)for(;(c=a+d*++e)>b;)g.push(c);else for(;(c=a+d*++e)<b;)g.push(c);return g};d3.requote=function(a){return a.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,
-d){var g=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&g.overrideMimeType(b);g.open("GET",a,true);g.onreadystatechange=function(){if(g.readyState==4)d(g.status<300?g:null)};g.send(null)};d3.text=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(g){d(g&&g.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var g=document.createRange();g.selectNode(document.body);
-d=g.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(g){d(g&&g.responseXML)})};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(){for(var a={},
-b,d=0,g=arguments.length;d<g;d++){b=arguments[d];a[b]=wa(b)}return a};d3.format=function(a){a=Ua.exec(a);var b=a[1]||" ",d=ra[a[3]]||ra["-"],g=a[5],e=+a[6],c=a[7],f=a[8],h=a[9];if(f)f=f.substring(1);if(g)b="0";if(h=="d")f="0";return function(i){i=+i;var k=i<0&&(i=-i);if(h=="d"&&i%1)return"";i=f?i.toFixed(f):""+i;if(c){for(var j=i.lastIndexOf("."),o=j>=0?i.substring(j):(j=i.length,""),p=[];j>0;)p.push(i.substring(j-=3,j+3));i=p.reverse().join(",")+o}k=(i=d(k,i)).length;if(k<e)i=Array(e-k+1).join(b)+
-i;return i}};var Ua=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ra={"+":function(a,b){return(a?"":"+")+b}," ":function(a,b){return(a?"":" ")+b},"-":function(a,b){return a?""+b:b}},Va=R(2),Wa=R(3),Xa={linear:function(){return xa},poly:R,quad:function(){return Va},cubic:function(){return Wa},sin:function(){return ya},exp:function(){return za},circle:function(){return Aa},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=
-b/(2*Math.PI)*Math.asin(1/a);return function(g){return 1+a*Math.pow(2,10*-g)*Math.sin((g-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Ba}},Ya={"in":function(a){return a},out:fa,"in-out":ga,"out-in":function(a){return ga(fa(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Ya[b](Xa[d].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 G||/^(#|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(d){return a+b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,g,e=0,c=[],f=[],
-h,i;for(g=0;d=aa.exec(b);++g){d.index&&c.push(b.substring(e,d.index));f.push({i:c.length,x:d[0]});c.push(null);e=aa.lastIndex}e<b.length&&c.push(b.substring(e));g=0;for(h=f.length;(d=aa.exec(a))&&g<h;++g){i=f[g];if(i.x==d[0]){if(i.i)if(c[i.i+1]==null){c[i.i-1]+=i.x;c.splice(i.i,1);for(d=g+1;d<h;++d)f[d].i--}else{c[i.i-1]+=i.x+c[i.i+1];c.splice(i.i,2);for(d=g+1;d<h;++d)f[d].i-=2}else if(c[i.i+1]==null)c[i.i]=i.x;else{c[i.i]=i.x+c[i.i+1];c.splice(i.i+1,1);for(d=g+1;d<h;++d)f[d].i--}f.splice(g,1);h--;
-g--}else i.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(i.x))}for(;g<h;){i=f.pop();if(c[i.i+1]==null)c[i.i]=i.x;else{c[i.i]=i.x+c[i.i+1];c.splice(i.i+1,1)}h--}if(c.length==1)return c[0]==null?f[0].x:function(){return b};return function(k){for(g=0;g<h;++g)c[(i=f[g]).i]=i.x(k);return c.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);var d=a.r,g=a.g,e=a.b,c=b.r-d,f=b.g-g,h=b.b-e;return function(i){return"rgb("+Math.round(d+c*i)+","+Math.round(g+f*i)+","+Math.round(e+h*i)+")"}};
-d3.interpolateHsl=function(a,b){a=d3.hsl(a);b=d3.hsl(b);var d=a.h,g=a.s,e=a.l,c=b.h-d,f=b.s-g,h=b.l-e;return function(i){return W(d+c*i,g+f*i,e+h*i).toString()}};d3.interpolateArray=function(a,b){var d=[],g=[],e=a.length,c=b.length,f=Math.min(a.length,b.length),h;for(h=0;h<f;++h)d.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)g[h]=a[h];for(;h<c;++h)g[h]=b[h];return function(i){for(h=0;h<f;++h)g[h]=d[h](i);return g}};d3.interpolateObject=function(a,b){var d={},g={},e;for(e in a)if(e in b)d[e]=(e in
-Za||/\bcolor\b/.test(e)?d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else g[e]=a[e];for(e in b)e in a||(g[e]=b[e]);return function(c){for(e in d)g[e]=d[e](c);return g}};var aa=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Za={background:1,fill:1,stroke:1};d3.rgb=function(a,b,d){return arguments.length==1?T(""+a,J,W):J(~~a,~~b,~~d)};var G={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"},ba;for(ba in G)G[ba]=T(G[ba],J,W);d3.hsl=function(a,b,d){return arguments.length==1?T(""+a,Da,V):V(+a,+b,+d)};var D=function(a,b){return b.querySelector(a)},ha=function(a,b){return N(b.querySelectorAll(a))};if(typeof Sizzle=="function"){D=function(a,b){return Sizzle(a,b)[0]};ha=Sizzle}var O=y([[document]]);
-O[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?O.select(a):y([[a]])};d3.selectAll=function(a){return typeof a=="string"?O.selectAll(a):y([N(a)])};d3.transition=O.transition;var Ha=0,Y=0,F=null,Z=0,K;d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*f)}function b(j){var o=Math.min(d,g),p=Math.max(d,g),m=p-o,n=Math.pow(10,Math.floor(Math.log(m/j)/Math.LN10));j=j/(m/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/
-n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,g=1,e=0,c=1,f=1/(g-d),h=(g-d)/(c-e),i=d3.interpolate,k=i(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,g];d=j[0];g=j[1];f=1/(g-d);h=(g-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(g-d)/(c-e);k=i(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return i;k=(i=j)(e,c);return a};
-a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return g(a(c))}var g=d3.scale.linear(),e=false;d.invert=function(c){return b(g.invert(c))};d.domain=function(c){if(!arguments.length)return g.domain().map(b);
-e=(c[0]||c[1])<0;g.domain(c.map(a));return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.interpolate=C(d,g.interpolate);d.ticks=function(){var c=g.domain(),f=[];if(c.every(isFinite)){var h=Math.floor(c[0]),i=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(f.push(b(h));h++<i;)for(var j=9;j>0;j--)f.push(b(h)*j);else{for(;h<i;h++)for(j=1;j<10;j++)f.push(b(h)*j);f.push(b(h))}for(h=0;f[h]<k;h++);for(i=f.length;f[i-1]>c;i--);f=f.slice(h,i)}return f};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};
-return d};d3.scale.pow=function(){function a(i){return h?-Math.pow(-i,c):Math.pow(i,c)}function b(i){return h?-Math.pow(-i,f):Math.pow(i,f)}function d(i){return g(a(i))}var g=d3.scale.linear(),e=d3.scale.linear(),c=1,f=1/c,h=false;d.invert=function(i){return b(g.invert(i))};d.domain=function(i){if(!arguments.length)return g.domain().map(b);h=(i[0]||i[1])<0;g.domain(i.map(a));e.domain(i);return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.inteprolate=C(d,g.interpolate);d.ticks=e.ticks;
-d.tickFormat=e.tickFormat;d.exponent=function(i){if(!arguments.length)return c;var k=d.domain();c=i;f=1/i;return d.domain(k)};return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return g[c%g.length]}var b=[],d={},g=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var f=-1,h=-1,i=b.length;++f<i;){c=b[f];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return g;g=c;
-return a};a.rangePoints=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length-1+f);g=b.length==1?[(h+i)/2]:d3.range(h+k*f/2,i+k/2,k);e=0;return a};a.rangeBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length+f);g=d3.range(h+k*f,i,k);e=k*(1-f);return a};a.rangeRoundBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=i-h,j=Math.floor(k/(b.length+f));g=d3.range(h+Math.round((k-(b.length-f)*j)/2),i,j);e=Math.round(j*(1-f));return a};a.rangeBand=
-function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range($a)};d3.scale.category20=function(){return d3.scale.ordinal().range(ab)};d3.scale.category20b=function(){return d3.scale.ordinal().range(bb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(cb)};var $a=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ab=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd",
-"#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bb=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cb=["#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 a(){for(var f=-1,h=c.length=e.length,i=g.length/h;++f<h;)c[f]=g[~~(f*i)]}function b(f){if(isNaN(f=+f))return NaN;for(var h=0,i=c.length-1;h<=i;){var k=h+i>>1,j=c[k];if(j<f)h=k+1;else if(j>f)i=k-1;else return k}return i<0?0:i}function d(f){return e[b(f)]}var g=[],e=[],c=[];d.domain=function(f){if(!arguments.length)return g;g=f.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(f){if(!arguments.length)return e;e=f;
-a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(f){return c[Math.max(0,Math.min(e,Math.floor(g*(f-b))))]}var b=0,d=1,g=2,e=1,c=[0,1];a.domain=function(f){if(!arguments.length)return[b,d];b=f[0];d=f[1];g=c.length/(d-b);return a};a.range=function(f){if(!arguments.length)return c;c=f;g=c.length/(d-b);e=c.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(){var c=b.apply(this,arguments),f=d.apply(this,arguments),h=g.apply(this,arguments)+
-I,i=e.apply(this,arguments)+I,k=i-h,j=k<Math.PI?"0":"1",o=Math.cos(h);h=Math.sin(h);var p=Math.cos(i);i=Math.sin(i);return k>=db?c?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+c+"A"+c+","+c+" 0 1,1 0,"+-c+"A"+c+","+c+" 0 1,1 0,"+c+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":c?"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L"+c*p+","+c*i+"A"+c+","+c+" 0 "+j+",0 "+c*o+","+c*h+"Z":"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L0,0Z"}var b=
-La,d=Ma,g=ja,e=ka;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d;d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return g;g=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};a.centroid=function(){var c=(b.apply(this,arguments)+d.apply(this,arguments))/2,f=(g.apply(this,arguments)+e.apply(this,arguments))/2+I;return[Math.cos(f)*c,Math.sin(f)*c]};return a};var I=-Math.PI/
-2,db=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(f){return f.length<1?null:"M"+e($(this,f,b,d),c)}var b=la,d=ma,g="linear",e=P[g],c=0.7;a.x=function(f){if(!arguments.length)return b;b=f;return a};a.y=function(f){if(!arguments.length)return d;d=f;return a};a.interpolate=function(f){if(!arguments.length)return g;e=P[g=f];return a};a.tension=function(f){if(!arguments.length)return c;c=f;return a};return a};var P={linear:H,basis:function(a){if(a.length<3)return H(a);var b=[],d=1,g=a.length,e=a[0],
-c=e[0],f=e[1],h=[c,c,c,(e=a[1])[0]],i=[f,f,f,e[1]];b.push(c,",",f);for(L(b,h,i);++d<g;){e=a[d];h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}for(d=-1;++d<2;){h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,g=a.length,e=g+4,c,f=[],h=[];++d<4;){c=a[d%g];f.push(c[0]);h.push(c[1])}b=[B(M,f),",",B(M,h)];for(--d;++d<e;){c=a[d%g];f.shift();f.push(c[0]);h.shift();h.push(c[1]);L(b,f,h)}return b.join("")},cardinal:function(a,b){if(a.length<
-3)return H(a);return a[0]+na(a,oa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return H(a);return a[0]+na(a,oa([a[a.length-2]].concat(a,[a[1]]),b))}},pa=[0,2/3,1/3,0],qa=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,g),f)+"L"+c($(this,h,b,d).reverse(),f)+"Z"}var b=la,d=Na,g=ma,e="linear",c=P[e],f=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return g;
-g=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return f;f=h;return a};return a};d3.svg.chord=function(){function a(h,i){var k=b(this,d,h,i),j=b(this,g,h,i);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,i,k,j){var o=i.call(h,k,j);i=e.call(h,o,j);k=c.call(h,o,j)+I;h=f.call(h,o,j)+I;return{r:i,a0:k,
-a1:h,p0:[i*Math.cos(k),i*Math.sin(k)],p1:[i*Math.cos(h),i*Math.sin(h)]}}var d=Oa,g=Pa,e=Qa,c=ja,f=ka;a.radius=function(h){if(!arguments.length)return e;e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return g;g=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=function(h){if(!arguments.length)return f;f=v(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||
-a).createSVGPoint();if(ca<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),g=d[0][0].getScreenCTM();ca=!(g.f||g.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(g,e){return(sa[b.call(this,g,e)]||sa.circle)(d.call(this,
-g,e))}var b=Sa,d=Ra;a.type=function(g){if(!arguments.length)return b;b=v(g);return a};a.size=function(g){if(!arguments.length)return d;d=v(g);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var sa={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+
--3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ta));var b=a*ta;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),ta=Math.tan(30*Math.PI/180)})();
+function Qa(a){return a.radius}function Ra(){return 64}function Sa(){return"circle"}d3={version:"1.5.0"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};var N=function(a){return Array.prototype.slice.call(a)};try{N(document.documentElement.childNodes)}catch(eb){N=ua}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 d=0,g=a.length,e=a[0],
+c;if(arguments.length==1)for(;++d<g;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<g;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,g=a.length,e=a[0],c;if(arguments.length==1)for(;++d<g;){if(e<(c=a[d]))e=c}else for(e=b(e);++d<g;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(h,i){if(i>=g.length)return f?f.call(d,h):c?h.sort(c):h;for(var k=-1,j=h.length,o=g[i++],p,m,n={};++k<j;)if((p=o(m=h[k]))in n)n[p].push(m);else n[p]=[m];for(p in n)n[p]=a(n[p],i);return n}function b(h,i){if(i>=
+g.length)return h;var k=[],j=e[i++],o;for(o in h)k.push({key:o,values:b(h[o],i)});j&&k.sort(function(p,m){return j(p.key,m.key)});return k}var d={},g=[],e=[],c,f;d.map=function(h){return a(h,0)};d.entries=function(h){return b(a(h,0),0)};d.key=function(h){g.push(h);return d};d.sortKeys=function(h){e[g.length-1]=h;return d};d.sortValues=function(h){c=h;return d};d.rollup=function(h){f=h;return d};return d};d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],
+d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],g=[],e,c=-1,f=a.length;if(arguments.length<2)b=va;for(;++c<f;)if(b.call(g,e=a[c],c))g=[];else{g.length||d.push(g);g.push(e)}return d};d3.range=function(a,b,d){if(arguments.length==1){b=a;a=0}if(d==null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var g=[],e=-1,c;if(d<0)for(;(c=
+a+d*++e)>b;)g.push(c);else for(;(c=a+d*++e)<b;)g.push(c);return g};d3.requote=function(a){return a.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,d){var g=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&g.overrideMimeType(b);g.open("GET",a,true);g.onreadystatechange=function(){if(g.readyState==4)d(g.status<300?g:null)};g.send(null)};d3.text=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(g){d(g&&g.responseText)})};d3.json=function(a,b){d3.text(a,
+"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var g=document.createRange();g.selectNode(document.body);d=g.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(g){d(g&&g.responseXML)})};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(){for(var a={},b,d=0,g=arguments.length;d<g;d++){b=arguments[d];a[b]=wa(b)}return a};d3.format=function(a){a=Ua.exec(a);var b=a[1]||" ",d=ra[a[3]]||ra["-"],g=a[5],e=+a[6],c=a[7],f=a[8],h=a[9];if(f)f=f.substring(1);if(g)b="0";if(h=="d")f="0";return function(i){i=+i;var k=i<0&&(i=-i);if(h=="d"&&i%1)return"";i=f?i.toFixed(f):""+i;if(c){for(var j=i.lastIndexOf("."),
+o=j>=0?i.substring(j):(j=i.length,""),p=[];j>0;)p.push(i.substring(j-=3,j+3));i=p.reverse().join(",")+o}k=(i=d(k,i)).length;if(k<e)i=Array(e-k+1).join(b)+i;return i}};var Ua=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ra={"+":function(a,b){return(a?"":"+")+b}," ":function(a,b){return(a?"":" ")+b},"-":function(a,b){return a?""+b:b}},Va=R(2),Wa=R(3),Xa={linear:function(){return xa},poly:R,quad:function(){return Va},cubic:function(){return Wa},sin:function(){return ya},
+exp:function(){return za},circle:function(){return Aa},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(g){return 1+a*Math.pow(2,10*-g)*Math.sin((g-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Ba}},Ya={"in":function(a){return a},out:fa,"in-out":ga,"out-in":function(a){return ga(fa(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>=
+0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Ya[b](Xa[d].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 G||/^(#|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(d){return a+
+b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,g,e=0,c=[],f=[],h,i;for(g=0;d=aa.exec(b);++g){d.index&&c.push(b.substring(e,d.index));f.push({i:c.length,x:d[0]});c.push(null);e=aa.lastIndex}e<b.length&&c.push(b.substring(e));g=0;for(h=f.length;(d=aa.exec(a))&&g<h;++g){i=f[g];if(i.x==d[0]){if(i.i)if(c[i.i+1]==null){c[i.i-1]+=i.x;c.splice(i.i,1);for(d=g+1;d<h;++d)f[d].i--}else{c[i.i-1]+=i.x+c[i.i+1];c.splice(i.i,2);
+for(d=g+1;d<h;++d)f[d].i-=2}else if(c[i.i+1]==null)c[i.i]=i.x;else{c[i.i]=i.x+c[i.i+1];c.splice(i.i+1,1);for(d=g+1;d<h;++d)f[d].i--}f.splice(g,1);h--;g--}else i.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(i.x))}for(;g<h;){i=f.pop();if(c[i.i+1]==null)c[i.i]=i.x;else{c[i.i]=i.x+c[i.i+1];c.splice(i.i+1,1)}h--}if(c.length==1)return c[0]==null?f[0].x:function(){return b};return function(k){for(g=0;g<h;++g)c[(i=f[g]).i]=i.x(k);return c.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);
+var d=a.r,g=a.g,e=a.b,c=b.r-d,f=b.g-g,h=b.b-e;return function(i){return"rgb("+Math.round(d+c*i)+","+Math.round(g+f*i)+","+Math.round(e+h*i)+")"}};d3.interpolateHsl=function(a,b){a=d3.hsl(a);b=d3.hsl(b);var d=a.h,g=a.s,e=a.l,c=b.h-d,f=b.s-g,h=b.l-e;return function(i){return W(d+c*i,g+f*i,e+h*i).toString()}};d3.interpolateArray=function(a,b){var d=[],g=[],e=a.length,c=b.length,f=Math.min(a.length,b.length),h;for(h=0;h<f;++h)d.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)g[h]=a[h];for(;h<c;++h)g[h]=
+b[h];return function(i){for(h=0;h<f;++h)g[h]=d[h](i);return g}};d3.interpolateObject=function(a,b){var d={},g={},e;for(e in a)if(e in b)d[e]=(e in Za||/\bcolor\b/.test(e)?d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else g[e]=a[e];for(e in b)e in a||(g[e]=b[e]);return function(c){for(e in d)g[e]=d[e](c);return g}};var aa=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Za={background:1,fill:1,stroke:1};d3.rgb=function(a,b,d){return arguments.length==1?T(""+a,J,W):J(~~a,~~b,~~d)};var G={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"},ba;for(ba in G)G[ba]=T(G[ba],J,W);d3.hsl=function(a,b,d){return arguments.length==1?T(""+a,Da,V):V(+a,+b,+d)};var D=function(a,b){return b.querySelector(a)},
+ha=function(a,b){return N(b.querySelectorAll(a))};if(typeof Sizzle=="function"){D=function(a,b){return Sizzle(a,b)[0]};ha=Sizzle}var O=y([[document]]);O[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?O.select(a):y([[a]])};d3.selectAll=function(a){return typeof a=="string"?O.selectAll(a):y([N(a)])};d3.transition=O.transition;var Ha=0,Y=0,F=null,Z=0,K;d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*f)}function b(j){var o=Math.min(d,g),p=Math.max(d,
+g),m=p-o,n=Math.pow(10,Math.floor(Math.log(m/j)/Math.LN10));j=j/(m/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,g=1,e=0,c=1,f=1/(g-d),h=(g-d)/(c-e),i=d3.interpolate,k=i(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,g];d=j[0];g=j[1];f=1/(g-d);h=(g-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(g-d)/(c-e);k=i(e,c);return a};
+a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return i;k=(i=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return g(a(c))}
+var g=d3.scale.linear(),e=false;d.invert=function(c){return b(g.invert(c))};d.domain=function(c){if(!arguments.length)return g.domain().map(b);e=(c[0]||c[1])<0;g.domain(c.map(a));return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.interpolate=C(d,g.interpolate);d.ticks=function(){var c=g.domain(),f=[];if(c.every(isFinite)){var h=Math.floor(c[0]),i=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(f.push(b(h));h++<i;)for(var j=9;j>0;j--)f.push(b(h)*j);else{for(;h<i;h++)for(j=1;j<10;j++)f.push(b(h)*
+j);f.push(b(h))}for(h=0;f[h]<k;h++);for(i=f.length;f[i-1]>c;i--);f=f.slice(h,i)}return f};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(i){return h?-Math.pow(-i,c):Math.pow(i,c)}function b(i){return h?-Math.pow(-i,f):Math.pow(i,f)}function d(i){return g(a(i))}var g=d3.scale.linear(),e=d3.scale.linear(),c=1,f=1/c,h=false;d.invert=function(i){return b(g.invert(i))};d.domain=function(i){if(!arguments.length)return g.domain().map(b);
+h=(i[0]||i[1])<0;g.domain(i.map(a));e.domain(i);return d};d.range=C(d,g.range);d.rangeRound=C(d,g.rangeRound);d.inteprolate=C(d,g.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(i){if(!arguments.length)return c;var k=d.domain();c=i;f=1/i;return d.domain(k)};return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return g[c%g.length]}var b=[],d={},g=[],e=0;a.domain=function(c){if(!arguments.length)return b;
+b=c;d={};for(var f=-1,h=-1,i=b.length;++f<i;){c=b[f];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return g;g=c;return a};a.rangePoints=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length-1+f);g=b.length==1?[(h+i)/2]:d3.range(h+k*f/2,i+k/2,k);e=0;return a};a.rangeBands=function(c,f){if(arguments.length<2)f=0;var h=c[0],i=c[1],k=(i-h)/(b.length+f);g=d3.range(h+k*f,i,k);e=k*(1-f);return a};a.rangeRoundBands=function(c,f){if(arguments.length<2)f=0;var h=
+c[0],i=c[1],k=i-h,j=Math.floor(k/(b.length+f));g=d3.range(h+Math.round((k-(b.length-f)*j)/2),i,j);e=Math.round(j*(1-f));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range($a)};d3.scale.category20=function(){return d3.scale.ordinal().range(ab)};d3.scale.category20b=function(){return d3.scale.ordinal().range(bb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(cb)};var $a=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd",
+"#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ab=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bb=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cb=["#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 a(){for(var f=-1,h=c.length=e.length,i=g.length/h;++f<h;)c[f]=g[~~(f*i)]}function b(f){if(isNaN(f=+f))return NaN;for(var h=0,i=c.length-1;h<=i;){var k=h+i>>1,j=c[k];if(j<f)h=k+1;else if(j>f)i=k-1;else return k}return i<0?0:i}function d(f){return e[b(f)]}var g=[],e=[],c=[];d.domain=function(f){if(!arguments.length)return g;
+g=f.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(f){if(!arguments.length)return e;e=f;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(f){return c[Math.max(0,Math.min(e,Math.floor(g*(f-b))))]}var b=0,d=1,g=2,e=1,c=[0,1];a.domain=function(f){if(!arguments.length)return[b,d];b=f[0];d=f[1];g=c.length/(d-b);return a};a.range=function(f){if(!arguments.length)return c;c=f;g=c.length/(d-b);e=c.length-1;return a};return a};
+d3.svg={};d3.svg.arc=function(){function a(){var c=b.apply(this,arguments),f=d.apply(this,arguments),h=g.apply(this,arguments)+I,i=e.apply(this,arguments)+I,k=i-h,j=k<Math.PI?"0":"1",o=Math.cos(h);h=Math.sin(h);var p=Math.cos(i);i=Math.sin(i);return k>=db?c?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+c+"A"+c+","+c+" 0 1,1 0,"+-c+"A"+c+","+c+" 0 1,1 0,"+c+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+-f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":c?"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+
+f*i+"L"+c*p+","+c*i+"A"+c+","+c+" 0 "+j+",0 "+c*o+","+c*h+"Z":"M"+f*o+","+f*h+"A"+f+","+f+" 0 "+j+",1 "+f*p+","+f*i+"L0,0Z"}var b=La,d=Ma,g=ja,e=ka;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d;d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return g;g=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};a.centroid=function(){var c=(b.apply(this,arguments)+d.apply(this,
+arguments))/2,f=(g.apply(this,arguments)+e.apply(this,arguments))/2+I;return[Math.cos(f)*c,Math.sin(f)*c]};return a};var I=-Math.PI/2,db=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(f){return f.length<1?null:"M"+e($(this,f,b,d),c)}var b=la,d=ma,g="linear",e=P[g],c=0.7;a.x=function(f){if(!arguments.length)return b;b=f;return a};a.y=function(f){if(!arguments.length)return d;d=f;return a};a.interpolate=function(f){if(!arguments.length)return g;e=P[g=f];return a};a.tension=function(f){if(!arguments.length)return c;
+c=f;return a};return a};var P={linear:H,basis:function(a){if(a.length<3)return H(a);var b=[],d=1,g=a.length,e=a[0],c=e[0],f=e[1],h=[c,c,c,(e=a[1])[0]],i=[f,f,f,e[1]];b.push(c,",",f);for(L(b,h,i);++d<g;){e=a[d];h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}for(d=-1;++d<2;){h.shift();h.push(e[0]);i.shift();i.push(e[1]);L(b,h,i)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,g=a.length,e=g+4,c,f=[],h=[];++d<4;){c=a[d%g];f.push(c[0]);h.push(c[1])}b=[B(M,f),",",B(M,h)];for(--d;++d<
+e;){c=a[d%g];f.shift();f.push(c[0]);h.shift();h.push(c[1]);L(b,f,h)}return b.join("")},cardinal:function(a,b){if(a.length<3)return H(a);return a[0]+na(a,oa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return H(a);return a[0]+na(a,oa([a[a.length-2]].concat(a,[a[1]]),b))}},pa=[0,2/3,1/3,0],qa=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,g),f)+"L"+c($(this,h,b,d).reverse(),f)+"Z"}var b=la,d=Na,g=ma,e="linear",c=P[e],f=0.7;a.x=function(h){if(!arguments.length)return b;
+b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return g;g=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return f;f=h;return a};return a};d3.svg.chord=function(){function a(h,i){var k=b(this,d,h,i),j=b(this,g,h,i);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+
+k.p0))+"Z"}function b(h,i,k,j){var o=i.call(h,k,j);i=e.call(h,o,j);k=c.call(h,o,j)+I;h=f.call(h,o,j)+I;return{r:i,a0:k,a1:h,p0:[i*Math.cos(k),i*Math.sin(k)],p1:[i*Math.cos(h),i*Math.sin(h)]}}var d=Oa,g=Pa,e=Qa,c=ja,f=ka;a.radius=function(h){if(!arguments.length)return e;e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return g;g=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=
+function(h){if(!arguments.length)return f;f=v(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(ca<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),g=d[0][0].getScreenCTM();ca=!(g.f||g.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=
+/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(g,e){return(sa[b.call(this,g,e)]||sa.circle)(d.call(this,g,e))}var b=Sa,d=Ra;a.type=function(g){if(!arguments.length)return b;b=v(g);return a};a.size=function(g){if(!arguments.length)return d;d=v(g);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var sa={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},
+cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ta));var b=a*ta;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+
+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),ta=Math.tan(30*Math.PI/180)})();
View
286 ex/flare.json
@@ -0,0 +1,286 @@
+{
+ "flare": {
+ "analytics": {
+ "cluster": {
+ "AgglomerativeCluster": 3938,
+ "CommunityStructure": 3812,
+ "HierarchicalCluster": 6714,
+ "MergeEdge": 743
+ },
+ "graph": {
+ "BetweennessCentrality": 3534,
+ "LinkDistance": 5731,
+ "MaxFlowMinCut": 7840,
+ "ShortestPaths": 5914,
+ "SpanningTree": 3416
+ },
+ "optimization": {
+ "AspectRatioBanker": 7074
+ }
+ },
+ "animate": {
+ "Easing": 17010,
+ "FunctionSequence": 5842,
+ "interpolate": {
+ "ArrayInterpolator": 1983,
+ "ColorInterpolator": 2047,
+ "DateInterpolator": 1375,
+ "Interpolator": 8746,
+ "MatrixInterpolator": 2202,
+ "NumberInterpolator": 1382,
+ "ObjectInterpolator": 1629,
+ "PointInterpolator": 1675,
+ "RectangleInterpolator": 2042
+ },
+ "ISchedulable": 1041,
+ "Parallel": 5176,
+ "Pause": 449,
+ "Scheduler": 5593,
+ "Sequence": 5534,
+ "Transition": 9201,
+ "Transitioner": 19975,
+ "TransitionEvent": 1116,
+ "Tween": 6006
+ },
+ "data": {
+ "converters": {
+ "Converters": 721,
+ "DelimitedTextConverter": 4294,
+ "GraphMLConverter": 9800,
+ "IDataConverter": 1314,
+ "JSONConverter": 2220
+ },
+ "DataField": 1759,
+ "DataSchema": 2165,
+ "DataSet": 586,
+ "DataSource": 3331,
+ "DataTable": 772,
+ "DataUtil": 3322
+ },
+ "display": {
+ "DirtySprite": 8833,
+ "LineSprite": 1732,
+ "RectSprite": 3623,
+ "TextSprite": 10066
+ },
+ "flex": {
+ "FlareVis": 4116
+ },
+ "physics": {
+ "DragForce": 1082,
+ "GravityForce": 1336,
+ "IForce": 319,
+ "NBodyForce": 10498,
+ "Particle": 2822,
+ "Simulation": 9983,
+ "Spring": 2213,
+ "SpringForce": 1681
+ },
+ "query": {
+ "AggregateExpression": 1616,
+ "And": 1027,
+ "Arithmetic": 3891,
+ "Average": 891,
+ "BinaryExpression": 2893,
+ "Comparison": 5103,
+ "CompositeExpression": 3677,
+ "Count": 781,
+ "DateUtil": 4141,
+ "Distinct": 933,
+ "Expression": 5130,
+ "ExpressionIterator": 3617,
+ "Fn": 3240,
+ "If": 2732,
+ "IsA": 2039,
+ "Literal": 1214,
+ "Match": 3748,
+ "Maximum": 843,
+ "methods": {
+ "add": 593,
+ "and": 330,
+ "average": 287,
+ "count": 277,
+ "distinct": 292,
+ "div": 595,
+ "eq": 594,
+ "fn": 460,
+ "gt": 603,
+ "gte": 625,
+ "iff": 748,
+ "isa": 461,
+ "lt": 597,
+ "lte": 619,
+ "max": 283,
+ "min": 283,
+ "mod": 591,
+ "mul": 603,
+ "neq": 599,
+ "not": 386,
+ "or": 323,
+ "orderby": 307,
+ "range": 772,
+ "select": 296,
+ "stddev": 363,
+ "sub": 600,
+ "sum": 280,
+ "update": 307,
+ "variance": 335,
+ "where": 299,
+ "xor": 354,
+ "_": 264
+ },
+ "Minimum": 843,
+ "Not": 1554,
+ "Or": 970,
+ "Query": 13896,
+ "Range": 1594,
+ "StringUtil": 4130,
+ "Sum": 791,
+ "Variable": 1124,
+ "Variance": 1876,
+ "Xor": 1101
+ },
+ "scale": {
+ "IScaleMap": 2105,
+ "LinearScale": 1316,
+ "LogScale": 3151,
+ "OrdinalScale": 3770,
+ "QuantileScale": 2435,
+ "QuantitativeScale": 4839,
+ "RootScale": 1756,
+ "Scale": 4268,
+ "ScaleType": 1821,
+ "TimeScale": 5833
+ },
+ "util": {
+ "Arrays": 8258,
+ "Colors": 10001,
+ "Dates": 8217,
+ "Displays": 12555,
+ "Filter": 2324,
+ "Geometry": 10993,
+ "heap": {
+ "FibonacciHeap": 9354,
+ "HeapNode": 1233
+ },
+ "IEvaluable": 335,
+ "IPredicate": 383,
+ "IValueProxy": 874,
+ "math": {
+ "DenseMatrix": 3165,
+ "IMatrix": 2815,
+ "SparseMatrix": 3366
+ },
+ "Maths": 17705,
+ "Orientation": 1486,
+ "palette": {
+ "ColorPalette": 6367,
+ "Palette": 1229,
+ "ShapePalette": 2059,
+ "SizePalette": 2291
+ },
+ "Property": 5559,
+ "Shapes": 19118,
+ "Sort": 6887,
+ "Stats": 6557,
+ "Strings": 22026
+ },
+ "vis": {
+ "axis": {
+ "Axes": 1302,
+ "Axis": 24593,
+ "AxisGridLine": 652,
+ "AxisLabel": 636,
+ "CartesianAxes": 6703
+ },
+ "controls": {
+ "AnchorControl": 2138,
+ "ClickControl": 3824,
+ "Control": 1353,
+ "ControlList": 4665,
+ "DragControl": 2649,
+ "ExpandControl": 2832,
+ "HoverControl": 4896,
+ "IControl": 763,
+ "PanZoomControl": 5222,
+ "SelectionControl": 7862,
+ "TooltipControl": 8435
+ },
+ "data": {
+ "Data": 20544,
+ "DataList": 19788,
+ "DataSprite": 10349,
+ "EdgeSprite": 3301,
+ "NodeSprite": 19382,
+ "render": {
+ "ArrowType": 698,
+ "EdgeRenderer": 5569,
+ "IRenderer": 353,
+ "ShapeRenderer": 2247
+ },
+ "ScaleBinding": 11275,
+ "Tree": 7147,
+ "TreeBuilder": 9930
+ },
+ "events": {
+ "DataEvent": 2313,
+ "SelectionEvent": 1880,
+ "TooltipEvent": 1701,
+ "VisualizationEvent": 1117
+ },
+ "legend": {
+ "Legend": 20859,
+ "LegendItem": 4614,
+ "LegendRange": 10530
+ },
+ "operator": {
+ "distortion": {
+ "BifocalDistortion": 4461,
+ "Distortion": 6314,
+ "FisheyeDistortion": 3444
+ },
+ "encoder": {
+ "ColorEncoder": 3179,
+ "Encoder": 4060,
+ "PropertyEncoder": 4138,
+ "ShapeEncoder": 1690,
+ "SizeEncoder": 1830
+ },
+ "filter": {
+ "FisheyeTreeFilter": 5219,
+ "GraphDistanceFilter": 3165,
+ "VisibilityFilter": 3509
+ },
+ "IOperator": 1286,
+ "label": {
+ "Labeler": 9956,
+ "RadialLabeler": 3899,
+ "StackedAreaLabeler": 3202
+ },
+ "layout": {
+ "AxisLayout": 6725,
+ "BundledEdgeRouter": 3727,
+ "CircleLayout": 9317,
+ "CirclePackingLayout": 12003,
+ "DendrogramLayout": 4853,
+ "ForceDirectedLayout": 8411,
+ "IcicleTreeLayout": 4864,
+ "IndentedTreeLayout": 3174,
+ "Layout": 7881,
+ "NodeLinkTreeLayout": 12870,
+ "PieLayout": 2728,
+ "RadialTreeLayout": 12348,
+ "RandomLayout": 870,
+ "StackedAreaLayout": 9121,
+ "TreeMapLayout": 9191
+ },
+ "Operator": 2490,
+ "OperatorList": 5248,
+ "OperatorSequence": 4190,
+ "OperatorSwitch": 2581,
+ "SortOperator": 2023
+ },
+ "Visualization": 16540
+ }
+ }
+}
View
4 ex/force.js
@@ -8,10 +8,10 @@ var vis = d3.select("#chart")
.attr("height", h);
d3.json("miserables.json", function(json) {
- var force = layout_force()
+ var force = d3.layout.force()
.nodes(json.nodes)
.links(json.links)
- .size({x: w, y: h})
+ .size([w, h])
.start();
var link = vis.selectAll("line.link")
View
5 ex/force.markdown
@@ -8,14 +8,11 @@ title: Force-Directed Graph
<div class="gallery" id="chart"> </div>
<link type="text/css" rel="stylesheet" href="force.css"/>
<script type="text/javascript" src="../d3.js"> </script>
-<script type="text/javascript" src="force_layout.js"> </script>
+<script type="text/javascript" src="../d3.layout.js"> </script>
<script type="text/javascript" src="force.js"> </script>
### Source Code
{% highlight js linenos %}
{% include force.js %}
{% endhighlight %}
-
-See also [force_layout.js](force_layout.js). This layout will be incorporated
-into a future version of D3 as `d3.layout.force`.
View
193 ex/force_layout.js
@@ -1,193 +0,0 @@
-// A rudimentary force layout using Gauss-Seidel.
-function layout_force() {
- var force = {},
- event = d3.dispatch("tick"),
- size = {x: 1, y: 1},
- alpha = .5,
- distance = 30,
- interval,
- nodes,
- links,
- distances;
-
- function tick() {
- var n = distances.length,
- i, // current index
- o, // current link
- s, // current source
- t, // current target
- l, // current distance
- x, // x-distance
- y; // y-distance
-
- // gauss-seidel relaxation
- for (i = 0; i < n; ++i) {
- o = distances[i];
- s = o.source;
- t = o.target;
- x = t.x - s.x;
- y = t.y - s.y;
- if (l = Math.sqrt(x * x + y * y)) {
- l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l;
- x *= l;
- y *= l;
- if (s.fixed) {
- if (t.fixed) continue;
- t.x -= x;
- t.y -= y;
- } else if (t.fixed) {
- s.x += x;
- s.y += y;
- } else {
- s.x += x;
- s.y += y;
- t.x -= x;
- t.y -= y;
- }
- }
- }
-
- // simulated annealing, basically
- if ((alpha *= .99) < 1e-6) force.stop();
-
- event.tick.dispatch({type: "tick"});
- }
-
- force.on = function(type, listener) {
- event[type].add(listener);
- return force;
- };
-
- force.nodes = function(x) {
- if (!arguments.length) return nodes;
- nodes = x;
- return force;
- };
-
- force.links = function(x) {
- if (!arguments.length) return links;
- links = x;
- return force;
- };
-
- force.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return force;
- };
-
- force.distance = function(d) {
- if (!arguments.length) return distance;
- distance = d;
- return force;
- };
-
- force.start = function() {
- var i,
- j,
- k,
- n = nodes.length,
- m = links.length,
- w = size.x,
- h = size.y,
- o;
-
- var paths = [];
- for (i = 0; i < n; ++i) {
- o = nodes[i];
- o.x = o.x || Math.random() * w;
- o.y = o.y || Math.random() * h;
- o.fixed = 0;
- paths[i] = [];
- for (j = 0; j < n; ++j) {
- paths[i][j] = Infinity;
- }
- paths[i][i] = 0;
- }
-
- for (i = 0; i < m; ++i) {
- o = links[i];
- paths[o.source][o.target] = 1;
- paths[o.target][o.source] = 1;
- o.source = nodes[o.source];
- o.target = nodes[o.target];
- }
-
- // Floyd-Warshall
- for (k = 0; k < n; ++k) {
- for (i = 0; i < n; ++i) {
- for (j = 0; j < n; ++j) {
- paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]);
- }
- }
- }
-
- distances = [];
- for (i = 0; i < n; ++i) {
- for (j = i + 1; j < n; ++j) {
- distances.push({
- source: nodes[i],
- target: nodes[j],
- distance: paths[i][j] * paths[i][j]
- });
- }
- }
-
- distances.sort(function(a, b) {
- return a.distance - b.distance;
- });
-
- if (interval) clearInterval(interval);
- interval = setInterval(tick, 24);
- return force;
- };
-
- force.resume = function() {
- alpha = .1;
- if (!interval) interval = setInterval(tick, 24);
- return force;
- };
-
- force.stop = function() {
- interval = clearInterval(interval);
- return force;
- };
-
- // use `node.call(force.drag)` to make nodes draggable
- force.drag = function() {
- var node, element;
-
- this
- .on("mouseover", function(d) { d.fixed = true; })
- .on("mouseout", function(d) { if (d != node) d.fixed = false; })
- .on("mousedown", mousedown);
-
- d3.select(window)
- .on("mousemove", mousemove)
- .on("mouseup", mouseup);
-
- function mousedown(d) {
- (node = d).fixed = true;
- element = this;
- d3.event.preventDefault();
- }
-
- function mousemove() {
- if (!node) return;
- var m = d3.svg.mouse(element);
- node.x = m[0];
- node.y = m[1];
- force.resume(); // restart annealing
- }
-
- function mouseup() {
- if (!node) return;
- mousemove();
- node = element = null;
- }
-
- return force;
- };
-
- return force;
-}
View
11 ex/index.markdown
@@ -65,6 +65,17 @@ title: Examples
</div>
<div class="list">
+ <a href="treemap.html">
+ <img src="../treemap.png"/>
+ </a>
+ <h4><a href="treemap.html">Treemap</a></h4>
+
+ <p>A treemap recursively subdivides area into rectangles; the area of any node
+ in the tree corresponds to its value. This example uses color to encode
+ different packages of the Flare visualization toolkit.</p>
+</div>
+
+<div class="list">
<a href="splom.html">
<img src="../splom.png"/>
</a>
View
8 ex/treemap.css
@@ -0,0 +1,8 @@
+.cell {
+ border: solid 1px white;
+ font: 10px sans-serif;
+ line-height: 12px;
+ overflow: hidden;
+ position: absolute;
+ text-indent: 2px;
+}
View
26 ex/treemap.js
@@ -0,0 +1,26 @@
+var w = 960,
+ h = 500,
+ color = d3.scale.category20c();
+
+var treemap = d3.layout.treemap()
+ .size([w, h])
+ .children(function(d, i) { return typeof d.value == "object" && d3.entries(d.value); })
+ .value(function(d) { return d.value; });
+
+var div = d3.select("#chart").append("div")
+ .style("position", "relative")
+ .style("width", w + "px")
+ .style("height", h + "px");
+
+d3.json("flare.json", function(json) {
+ div.data(d3.entries(json)).selectAll("div")
+ .data(treemap)
+ .enter().append("div")
+ .attr("class", "cell")
+ .style("background", function(d) { return d.children ? color(d.data.key) : null; })
+ .style("left", function(d) { return d.x + "px"; })
+ .style("top", function(d) { return d.y + "px"; })
+ .style("width", function(d) { return d.dx - 1 + "px"; })
+ .style("height", function(d) { return d.dy - 1 + "px"; })
+ .text(function(d) { return d.children ? null : d.data.key; });
+});