Path: blob/master/sandbox/RFinance2014/libraries/widgets/nvd3/js/d3.v2.js
1433 views
(function() {1function d3_class(ctor, properties) {2try {3for (var key in properties) {4Object.defineProperty(ctor.prototype, key, {5value: properties[key],6enumerable: false7});8}9} catch (e) {10ctor.prototype = properties;11}12}13function d3_arrayCopy(pseudoarray) {14var i = -1, n = pseudoarray.length, array = [];15while (++i < n) array.push(pseudoarray[i]);16return array;17}18function d3_arraySlice(pseudoarray) {19return Array.prototype.slice.call(pseudoarray);20}21function d3_Map() {}22function d3_identity(d) {23return d;24}25function d3_this() {26return this;27}28function d3_true() {29return true;30}31function d3_functor(v) {32return typeof v === "function" ? v : function() {33return v;34};35}36function d3_rebind(target, source, method) {37return function() {38var value = method.apply(source, arguments);39return arguments.length ? target : value;40};41}42function d3_number(x) {43return x != null && !isNaN(x);44}45function d3_zipLength(d) {46return d.length;47}48function d3_splitter(d) {49return d == null;50}51function d3_collapse(s) {52return s.trim().replace(/\s+/g, " ");53}54function d3_range_integerScale(x) {55var k = 1;56while (x * k % 1) k *= 10;57return k;58}59function d3_dispatch() {}60function d3_dispatch_event(dispatch) {61function event() {62var z = listeners, i = -1, n = z.length, l;63while (++i < n) if (l = z[i].on) l.apply(this, arguments);64return dispatch;65}66var listeners = [], listenerByName = new d3_Map;67event.on = function(name, listener) {68var l = listenerByName.get(name), i;69if (arguments.length < 2) return l && l.on;70if (l) {71l.on = null;72listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));73listenerByName.remove(name);74}75if (listener) listeners.push(listenerByName.set(name, {76on: listener77}));78return dispatch;79};80return event;81}82function d3_format_precision(x, p) {83return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);84}85function d3_format_typeDefault(x) {86return x + "";87}88function d3_format_group(value) {89var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = [];90while (i > 0) t.push(value.substring(i -= 3, i + 3));91return t.reverse().join(",") + f;92}93function d3_formatPrefix(d, i) {94var k = Math.pow(10, Math.abs(8 - i) * 3);95return {96scale: i > 8 ? function(d) {97return d / k;98} : function(d) {99return d * k;100},101symbol: d102};103}104function d3_ease_clamp(f) {105return function(t) {106return t <= 0 ? 0 : t >= 1 ? 1 : f(t);107};108}109function d3_ease_reverse(f) {110return function(t) {111return 1 - f(1 - t);112};113}114function d3_ease_reflect(f) {115return function(t) {116return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));117};118}119function d3_ease_identity(t) {120return t;121}122function d3_ease_poly(e) {123return function(t) {124return Math.pow(t, e);125};126}127function d3_ease_sin(t) {128return 1 - Math.cos(t * Math.PI / 2);129}130function d3_ease_exp(t) {131return Math.pow(2, 10 * (t - 1));132}133function d3_ease_circle(t) {134return 1 - Math.sqrt(1 - t * t);135}136function d3_ease_elastic(a, p) {137var s;138if (arguments.length < 2) p = .45;139if (arguments.length < 1) {140a = 1;141s = p / 4;142} else s = p / (2 * Math.PI) * Math.asin(1 / a);143return function(t) {144return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);145};146}147function d3_ease_back(s) {148if (!s) s = 1.70158;149return function(t) {150return t * t * ((s + 1) * t - s);151};152}153function d3_ease_bounce(t) {154return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;155}156function d3_eventCancel() {157d3.event.stopPropagation();158d3.event.preventDefault();159}160function d3_eventSource() {161var e = d3.event, s;162while (s = e.sourceEvent) e = s;163return e;164}165function d3_eventDispatch(target) {166var dispatch = new d3_dispatch, i = 0, n = arguments.length;167while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);168dispatch.of = function(thiz, argumentz) {169return function(e1) {170try {171var e0 = e1.sourceEvent = d3.event;172e1.target = target;173d3.event = e1;174dispatch[e1.type].apply(thiz, argumentz);175} finally {176d3.event = e0;177}178};179};180return dispatch;181}182function d3_transform(m) {183var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;184if (r0[0] * r1[1] < r1[0] * r0[1]) {185r0[0] *= -1;186r0[1] *= -1;187kx *= -1;188kz *= -1;189}190this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;191this.translate = [ m.e, m.f ];192this.scale = [ kx, ky ];193this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;194}195function d3_transformDot(a, b) {196return a[0] * b[0] + a[1] * b[1];197}198function d3_transformNormalize(a) {199var k = Math.sqrt(d3_transformDot(a, a));200if (k) {201a[0] /= k;202a[1] /= k;203}204return k;205}206function d3_transformCombine(a, b, k) {207a[0] += k * b[0];208a[1] += k * b[1];209return a;210}211function d3_interpolateByName(name) {212return name == "transform" ? d3.interpolateTransform : d3.interpolate;213}214function d3_uninterpolateNumber(a, b) {215b = b - (a = +a) ? 1 / (b - a) : 0;216return function(x) {217return (x - a) * b;218};219}220function d3_uninterpolateClamp(a, b) {221b = b - (a = +a) ? 1 / (b - a) : 0;222return function(x) {223return Math.max(0, Math.min(1, (x - a) * b));224};225}226function d3_rgb(r, g, b) {227return new d3_Rgb(r, g, b);228}229function d3_Rgb(r, g, b) {230this.r = r;231this.g = g;232this.b = b;233}234function d3_rgb_hex(v) {235return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);236}237function d3_rgb_parse(format, rgb, hsl) {238var r = 0, g = 0, b = 0, m1, m2, name;239m1 = /([a-z]+)\((.*)\)/i.exec(format);240if (m1) {241m2 = m1[2].split(",");242switch (m1[1]) {243case "hsl":244{245return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);246}247case "rgb":248{249return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));250}251}252}253if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);254if (format != null && format.charAt(0) === "#") {255if (format.length === 4) {256r = format.charAt(1);257r += r;258g = format.charAt(2);259g += g;260b = format.charAt(3);261b += b;262} else if (format.length === 7) {263r = format.substring(1, 3);264g = format.substring(3, 5);265b = format.substring(5, 7);266}267r = parseInt(r, 16);268g = parseInt(g, 16);269b = parseInt(b, 16);270}271return rgb(r, g, b);272}273function d3_rgb_hsl(r, g, b) {274var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;275if (d) {276s = l < .5 ? d / (max + min) : d / (2 - max - min);277if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;278h *= 60;279} else {280s = h = 0;281}282return d3_hsl(h, s, l);283}284function d3_rgb_lab(r, g, b) {285r = d3_rgb_xyz(r);286g = d3_rgb_xyz(g);287b = d3_rgb_xyz(b);288var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);289return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));290}291function d3_rgb_xyz(r) {292return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);293}294function d3_rgb_parseNumber(c) {295var f = parseFloat(c);296return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;297}298function d3_hsl(h, s, l) {299return new d3_Hsl(h, s, l);300}301function d3_Hsl(h, s, l) {302this.h = h;303this.s = s;304this.l = l;305}306function d3_hsl_rgb(h, s, l) {307function v(h) {308if (h > 360) h -= 360; else if (h < 0) h += 360;309if (h < 60) return m1 + (m2 - m1) * h / 60;310if (h < 180) return m2;311if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;312return m1;313}314function vv(h) {315return Math.round(v(h) * 255);316}317var m1, m2;318h = h % 360;319if (h < 0) h += 360;320s = s < 0 ? 0 : s > 1 ? 1 : s;321l = l < 0 ? 0 : l > 1 ? 1 : l;322m2 = l <= .5 ? l * (1 + s) : l + s - l * s;323m1 = 2 * l - m2;324return d3_rgb(vv(h + 120), vv(h), vv(h - 120));325}326function d3_hcl(h, c, l) {327return new d3_Hcl(h, c, l);328}329function d3_Hcl(h, c, l) {330this.h = h;331this.c = c;332this.l = l;333}334function d3_hcl_lab(h, c, l) {335return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c);336}337function d3_lab(l, a, b) {338return new d3_Lab(l, a, b);339}340function d3_Lab(l, a, b) {341this.l = l;342this.a = a;343this.b = b;344}345function d3_lab_rgb(l, a, b) {346var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;347x = d3_lab_xyz(x) * d3_lab_X;348y = d3_lab_xyz(y) * d3_lab_Y;349z = d3_lab_xyz(z) * d3_lab_Z;350return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));351}352function d3_lab_hcl(l, a, b) {353return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l);354}355function d3_lab_xyz(x) {356return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;357}358function d3_xyz_lab(x) {359return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;360}361function d3_xyz_rgb(r) {362return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));363}364function d3_selection(groups) {365d3_arraySubclass(groups, d3_selectionPrototype);366return groups;367}368function d3_selection_selector(selector) {369return function() {370return d3_select(selector, this);371};372}373function d3_selection_selectorAll(selector) {374return function() {375return d3_selectAll(selector, this);376};377}378function d3_selection_attr(name, value) {379function attrNull() {380this.removeAttribute(name);381}382function attrNullNS() {383this.removeAttributeNS(name.space, name.local);384}385function attrConstant() {386this.setAttribute(name, value);387}388function attrConstantNS() {389this.setAttributeNS(name.space, name.local, value);390}391function attrFunction() {392var x = value.apply(this, arguments);393if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);394}395function attrFunctionNS() {396var x = value.apply(this, arguments);397if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);398}399name = d3.ns.qualify(name);400return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;401}402function d3_selection_classedRe(name) {403return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");404}405function d3_selection_classed(name, value) {406function classedConstant() {407var i = -1;408while (++i < n) name[i](this, value);409}410function classedFunction() {411var i = -1, x = value.apply(this, arguments);412while (++i < n) name[i](this, x);413}414name = name.trim().split(/\s+/).map(d3_selection_classedName);415var n = name.length;416return typeof value === "function" ? classedFunction : classedConstant;417}418function d3_selection_classedName(name) {419var re = d3_selection_classedRe(name);420return function(node, value) {421if (c = node.classList) return value ? c.add(name) : c.remove(name);422var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;423if (value) {424re.lastIndex = 0;425if (!re.test(cv)) {426cv = d3_collapse(cv + " " + name);427if (cb) c.baseVal = cv; else node.className = cv;428}429} else if (cv) {430cv = d3_collapse(cv.replace(re, " "));431if (cb) c.baseVal = cv; else node.className = cv;432}433};434}435function d3_selection_style(name, value, priority) {436function styleNull() {437this.style.removeProperty(name);438}439function styleConstant() {440this.style.setProperty(name, value, priority);441}442function styleFunction() {443var x = value.apply(this, arguments);444if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);445}446return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;447}448function d3_selection_property(name, value) {449function propertyNull() {450delete this[name];451}452function propertyConstant() {453this[name] = value;454}455function propertyFunction() {456var x = value.apply(this, arguments);457if (x == null) delete this[name]; else this[name] = x;458}459return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;460}461function d3_selection_dataNode(data) {462return {463__data__: data464};465}466function d3_selection_filter(selector) {467return function() {468return d3_selectMatches(this, selector);469};470}471function d3_selection_sortComparator(comparator) {472if (!arguments.length) comparator = d3.ascending;473return function(a, b) {474return comparator(a && a.__data__, b && b.__data__);475};476}477function d3_selection_on(type, listener, capture) {478function onRemove() {479var wrapper = this[name];480if (wrapper) {481this.removeEventListener(type, wrapper, wrapper.$);482delete this[name];483}484}485function onAdd() {486function wrapper(e) {487var o = d3.event;488d3.event = e;489args[0] = node.__data__;490try {491listener.apply(node, args);492} finally {493d3.event = o;494}495}496var node = this, args = arguments;497onRemove.call(this);498this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);499wrapper._ = listener;500}501var name = "__on" + type, i = type.indexOf(".");502if (i > 0) type = type.substring(0, i);503return listener ? onAdd : onRemove;504}505function d3_selection_each(groups, callback) {506for (var j = 0, m = groups.length; j < m; j++) {507for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {508if (node = group[i]) callback(node, i, j);509}510}511return groups;512}513function d3_selection_enter(selection) {514d3_arraySubclass(selection, d3_selection_enterPrototype);515return selection;516}517function d3_transition(groups, id, time) {518d3_arraySubclass(groups, d3_transitionPrototype);519var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;520groups.id = id;521groups.time = time;522groups.tween = function(name, tween) {523if (arguments.length < 2) return tweens.get(name);524if (tween == null) tweens.remove(name); else tweens.set(name, tween);525return groups;526};527groups.ease = function(value) {528if (!arguments.length) return ease;529ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);530return groups;531};532groups.each = function(type, listener) {533if (arguments.length < 2) return d3_transition_each.call(groups, type);534event.on(type, listener);535return groups;536};537d3.timer(function(elapsed) {538return d3_selection_each(groups, function(node, i, j) {539function start(elapsed) {540if (lock.active > id) return stop();541lock.active = id;542tweens.forEach(function(key, value) {543if (value = value.call(node, d, i)) {544tweened.push(value);545}546});547event.start.call(node, d, i);548if (!tick(elapsed)) d3.timer(tick, 0, time);549return 1;550}551function tick(elapsed) {552if (lock.active !== id) return stop();553var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;554while (n > 0) {555tweened[--n].call(node, e);556}557if (t >= 1) {558stop();559d3_transitionId = id;560event.end.call(node, d, i);561d3_transitionId = 0;562return 1;563}564}565function stop() {566if (!--lock.count) delete node.__transition__;567return 1;568}569var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = {570active: 0,571count: 0572}), d = node.__data__;573++lock.count;574delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);575});576}, 0, time);577return groups;578}579function d3_transition_each(callback) {580var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration;581d3_transitionId = this.id;582d3_transitionEase = this.ease();583d3_selection_each(this, function(node, i, j) {584d3_transitionDelay = node.delay;585d3_transitionDuration = node.duration;586callback.call(node = node.node, node.__data__, i, j);587});588d3_transitionId = id;589d3_transitionEase = ease;590d3_transitionDelay = delay;591d3_transitionDuration = duration;592return this;593}594function d3_tweenNull(d, i, a) {595return a != "" && d3_tweenRemove;596}597function d3_tweenByName(b, name) {598return d3.tween(b, d3_interpolateByName(name));599}600function d3_timer_step() {601var elapsed, now = Date.now(), t1 = d3_timer_queue;602while (t1) {603elapsed = now - t1.then;604if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);605t1 = t1.next;606}607var delay = d3_timer_flush() - now;608if (delay > 24) {609if (isFinite(delay)) {610clearTimeout(d3_timer_timeout);611d3_timer_timeout = setTimeout(d3_timer_step, delay);612}613d3_timer_interval = 0;614} else {615d3_timer_interval = 1;616d3_timer_frame(d3_timer_step);617}618}619function d3_timer_flush() {620var t0 = null, t1 = d3_timer_queue, then = Infinity;621while (t1) {622if (t1.flush) {623t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;624} else {625then = Math.min(then, t1.then + t1.delay);626t1 = (t0 = t1).next;627}628}629return then;630}631function d3_mousePoint(container, e) {632var svg = container.ownerSVGElement || container;633if (svg.createSVGPoint) {634var point = svg.createSVGPoint();635if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {636svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);637var ctm = svg[0][0].getScreenCTM();638d3_mouse_bug44083 = !(ctm.f || ctm.e);639svg.remove();640}641if (d3_mouse_bug44083) {642point.x = e.pageX;643point.y = e.pageY;644} else {645point.x = e.clientX;646point.y = e.clientY;647}648point = point.matrixTransform(container.getScreenCTM().inverse());649return [ point.x, point.y ];650}651var rect = container.getBoundingClientRect();652return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];653}654function d3_noop() {}655function d3_scaleExtent(domain) {656var start = domain[0], stop = domain[domain.length - 1];657return start < stop ? [ start, stop ] : [ stop, start ];658}659function d3_scaleRange(scale) {660return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());661}662function d3_scale_nice(domain, nice) {663var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;664if (x1 < x0) {665dx = i0, i0 = i1, i1 = dx;666dx = x0, x0 = x1, x1 = dx;667}668if (nice = nice(x1 - x0)) {669domain[i0] = nice.floor(x0);670domain[i1] = nice.ceil(x1);671}672return domain;673}674function d3_scale_niceDefault() {675return Math;676}677function d3_scale_linear(domain, range, interpolate, clamp) {678function rescale() {679var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;680output = linear(domain, range, uninterpolate, interpolate);681input = linear(range, domain, uninterpolate, d3.interpolate);682return scale;683}684function scale(x) {685return output(x);686}687var output, input;688scale.invert = function(y) {689return input(y);690};691scale.domain = function(x) {692if (!arguments.length) return domain;693domain = x.map(Number);694return rescale();695};696scale.range = function(x) {697if (!arguments.length) return range;698range = x;699return rescale();700};701scale.rangeRound = function(x) {702return scale.range(x).interpolate(d3.interpolateRound);703};704scale.clamp = function(x) {705if (!arguments.length) return clamp;706clamp = x;707return rescale();708};709scale.interpolate = function(x) {710if (!arguments.length) return interpolate;711interpolate = x;712return rescale();713};714scale.ticks = function(m) {715return d3_scale_linearTicks(domain, m);716};717scale.tickFormat = function(m) {718return d3_scale_linearTickFormat(domain, m);719};720scale.nice = function() {721d3_scale_nice(domain, d3_scale_linearNice);722return rescale();723};724scale.copy = function() {725return d3_scale_linear(domain, range, interpolate, clamp);726};727return rescale();728}729function d3_scale_linearRebind(scale, linear) {730return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");731}732function d3_scale_linearNice(dx) {733dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);734return dx && {735floor: function(x) {736return Math.floor(x / dx) * dx;737},738ceil: function(x) {739return Math.ceil(x / dx) * dx;740}741};742}743function d3_scale_linearTickRange(domain, m) {744var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;745if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;746extent[0] = Math.ceil(extent[0] / step) * step;747extent[1] = Math.floor(extent[1] / step) * step + step * .5;748extent[2] = step;749return extent;750}751function d3_scale_linearTicks(domain, m) {752return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));753}754function d3_scale_linearTickFormat(domain, m) {755return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");756}757function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {758var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);759return function(x) {760return i(u(x));761};762}763function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {764var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;765if (domain[k] < domain[0]) {766domain = domain.slice().reverse();767range = range.slice().reverse();768}769while (++j <= k) {770u.push(uninterpolate(domain[j - 1], domain[j]));771i.push(interpolate(range[j - 1], range[j]));772}773return function(x) {774var j = d3.bisect(domain, x, 1, k) - 1;775return i[j](u[j](x));776};777}778function d3_scale_log(linear, log) {779function scale(x) {780return linear(log(x));781}782var pow = log.pow;783scale.invert = function(x) {784return pow(linear.invert(x));785};786scale.domain = function(x) {787if (!arguments.length) return linear.domain().map(pow);788log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;789pow = log.pow;790linear.domain(x.map(log));791return scale;792};793scale.nice = function() {794linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));795return scale;796};797scale.ticks = function() {798var extent = d3_scaleExtent(linear.domain()), ticks = [];799if (extent.every(isFinite)) {800var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);801if (log === d3_scale_logn) {802ticks.push(pow(i));803for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);804} else {805for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);806ticks.push(pow(i));807}808for (i = 0; ticks[i] < u; i++) {}809for (j = ticks.length; ticks[j - 1] > v; j--) {}810ticks = ticks.slice(i, j);811}812return ticks;813};814scale.tickFormat = function(n, format) {815if (arguments.length < 2) format = d3_scale_logFormat;816if (arguments.length < 1) return format;817var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;818return function(d) {819return d / pow(f(log(d) + e)) <= k ? format(d) : "";820};821};822scale.copy = function() {823return d3_scale_log(linear.copy(), log);824};825return d3_scale_linearRebind(scale, linear);826}827function d3_scale_logp(x) {828return Math.log(x < 0 ? 0 : x) / Math.LN10;829}830function d3_scale_logn(x) {831return -Math.log(x > 0 ? 0 : -x) / Math.LN10;832}833function d3_scale_pow(linear, exponent) {834function scale(x) {835return linear(powp(x));836}837var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);838scale.invert = function(x) {839return powb(linear.invert(x));840};841scale.domain = function(x) {842if (!arguments.length) return linear.domain().map(powb);843linear.domain(x.map(powp));844return scale;845};846scale.ticks = function(m) {847return d3_scale_linearTicks(scale.domain(), m);848};849scale.tickFormat = function(m) {850return d3_scale_linearTickFormat(scale.domain(), m);851};852scale.nice = function() {853return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));854};855scale.exponent = function(x) {856if (!arguments.length) return exponent;857var domain = scale.domain();858powp = d3_scale_powPow(exponent = x);859powb = d3_scale_powPow(1 / exponent);860return scale.domain(domain);861};862scale.copy = function() {863return d3_scale_pow(linear.copy(), exponent);864};865return d3_scale_linearRebind(scale, linear);866}867function d3_scale_powPow(e) {868return function(x) {869return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);870};871}872function d3_scale_ordinal(domain, ranger) {873function scale(x) {874return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];875}876function steps(start, step) {877return d3.range(domain.length).map(function(i) {878return start + step * i;879});880}881var index, range, rangeBand;882scale.domain = function(x) {883if (!arguments.length) return domain;884domain = [];885index = new d3_Map;886var i = -1, n = x.length, xi;887while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));888return scale[ranger.t].apply(scale, ranger.a);889};890scale.range = function(x) {891if (!arguments.length) return range;892range = x;893rangeBand = 0;894ranger = {895t: "range",896a: arguments897};898return scale;899};900scale.rangePoints = function(x, padding) {901if (arguments.length < 2) padding = 0;902var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);903range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);904rangeBand = 0;905ranger = {906t: "rangePoints",907a: arguments908};909return scale;910};911scale.rangeBands = function(x, padding, outerPadding) {912if (arguments.length < 2) padding = 0;913if (arguments.length < 3) outerPadding = padding;914var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);915range = steps(start + step * outerPadding, step);916if (reverse) range.reverse();917rangeBand = step * (1 - padding);918ranger = {919t: "rangeBands",920a: arguments921};922return scale;923};924scale.rangeRoundBands = function(x, padding, outerPadding) {925if (arguments.length < 2) padding = 0;926if (arguments.length < 3) outerPadding = padding;927var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;928range = steps(start + Math.round(error / 2), step);929if (reverse) range.reverse();930rangeBand = Math.round(step * (1 - padding));931ranger = {932t: "rangeRoundBands",933a: arguments934};935return scale;936};937scale.rangeBand = function() {938return rangeBand;939};940scale.rangeExtent = function() {941return d3_scaleExtent(ranger.a[0]);942};943scale.copy = function() {944return d3_scale_ordinal(domain, ranger);945};946return scale.domain(domain);947}948function d3_scale_quantile(domain, range) {949function rescale() {950var k = 0, n = domain.length, q = range.length;951thresholds = [];952while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);953return scale;954}955function scale(x) {956if (isNaN(x = +x)) return NaN;957return range[d3.bisect(thresholds, x)];958}959var thresholds;960scale.domain = function(x) {961if (!arguments.length) return domain;962domain = x.filter(function(d) {963return !isNaN(d);964}).sort(d3.ascending);965return rescale();966};967scale.range = function(x) {968if (!arguments.length) return range;969range = x;970return rescale();971};972scale.quantiles = function() {973return thresholds;974};975scale.copy = function() {976return d3_scale_quantile(domain, range);977};978return rescale();979}980function d3_scale_quantize(x0, x1, range) {981function scale(x) {982return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];983}984function rescale() {985kx = range.length / (x1 - x0);986i = range.length - 1;987return scale;988}989var kx, i;990scale.domain = function(x) {991if (!arguments.length) return [ x0, x1 ];992x0 = +x[0];993x1 = +x[x.length - 1];994return rescale();995};996scale.range = function(x) {997if (!arguments.length) return range;998range = x;999return rescale();1000};1001scale.copy = function() {1002return d3_scale_quantize(x0, x1, range);1003};1004return rescale();1005}1006function d3_scale_threshold(domain, range) {1007function scale(x) {1008return range[d3.bisect(domain, x)];1009}1010scale.domain = function(_) {1011if (!arguments.length) return domain;1012domain = _;1013return scale;1014};1015scale.range = function(_) {1016if (!arguments.length) return range;1017range = _;1018return scale;1019};1020scale.copy = function() {1021return d3_scale_threshold(domain, range);1022};1023return scale;1024}1025function d3_scale_identity(domain) {1026function identity(x) {1027return +x;1028}1029identity.invert = identity;1030identity.domain = identity.range = function(x) {1031if (!arguments.length) return domain;1032domain = x.map(identity);1033return identity;1034};1035identity.ticks = function(m) {1036return d3_scale_linearTicks(domain, m);1037};1038identity.tickFormat = function(m) {1039return d3_scale_linearTickFormat(domain, m);1040};1041identity.copy = function() {1042return d3_scale_identity(domain);1043};1044return identity;1045}1046function d3_svg_arcInnerRadius(d) {1047return d.innerRadius;1048}1049function d3_svg_arcOuterRadius(d) {1050return d.outerRadius;1051}1052function d3_svg_arcStartAngle(d) {1053return d.startAngle;1054}1055function d3_svg_arcEndAngle(d) {1056return d.endAngle;1057}1058function d3_svg_line(projection) {1059function line(data) {1060function segment() {1061segments.push("M", interpolate(projection(points), tension));1062}1063var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);1064while (++i < n) {1065if (defined.call(this, d = data[i], i)) {1066points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);1067} else if (points.length) {1068segment();1069points = [];1070}1071}1072if (points.length) segment();1073return segments.length ? segments.join("") : null;1074}1075var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;1076line.x = function(_) {1077if (!arguments.length) return x;1078x = _;1079return line;1080};1081line.y = function(_) {1082if (!arguments.length) return y;1083y = _;1084return line;1085};1086line.defined = function(_) {1087if (!arguments.length) return defined;1088defined = _;1089return line;1090};1091line.interpolate = function(_) {1092if (!arguments.length) return interpolateKey;1093if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;1094return line;1095};1096line.tension = function(_) {1097if (!arguments.length) return tension;1098tension = _;1099return line;1100};1101return line;1102}1103function d3_svg_lineX(d) {1104return d[0];1105}1106function d3_svg_lineY(d) {1107return d[1];1108}1109function d3_svg_lineLinear(points) {1110return points.join("L");1111}1112function d3_svg_lineLinearClosed(points) {1113return d3_svg_lineLinear(points) + "Z";1114}1115function d3_svg_lineStepBefore(points) {1116var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];1117while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);1118return path.join("");1119}1120function d3_svg_lineStepAfter(points) {1121var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];1122while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);1123return path.join("");1124}1125function d3_svg_lineCardinalOpen(points, tension) {1126return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));1127}1128function d3_svg_lineCardinalClosed(points, tension) {1129return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));1130}1131function d3_svg_lineCardinal(points, tension, closed) {1132return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));1133}1134function d3_svg_lineHermite(points, tangents) {1135if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {1136return d3_svg_lineLinear(points);1137}1138var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;1139if (quad) {1140path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];1141p0 = points[1];1142pi = 2;1143}1144if (tangents.length > 1) {1145t = tangents[1];1146p = points[pi];1147pi++;1148path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];1149for (var i = 2; i < tangents.length; i++, pi++) {1150p = points[pi];1151t = tangents[i];1152path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];1153}1154}1155if (quad) {1156var lp = points[pi];1157path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];1158}1159return path;1160}1161function d3_svg_lineCardinalTangents(points, tension) {1162var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;1163while (++i < n) {1164p0 = p1;1165p1 = p2;1166p2 = points[i];1167tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);1168}1169return tangents;1170}1171function d3_svg_lineBasis(points) {1172if (points.length < 3) return d3_svg_lineLinear(points);1173var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];1174d3_svg_lineBasisBezier(path, px, py);1175while (++i < n) {1176pi = points[i];1177px.shift();1178px.push(pi[0]);1179py.shift();1180py.push(pi[1]);1181d3_svg_lineBasisBezier(path, px, py);1182}1183i = -1;1184while (++i < 2) {1185px.shift();1186px.push(pi[0]);1187py.shift();1188py.push(pi[1]);1189d3_svg_lineBasisBezier(path, px, py);1190}1191return path.join("");1192}1193function d3_svg_lineBasisOpen(points) {1194if (points.length < 4) return d3_svg_lineLinear(points);1195var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];1196while (++i < 3) {1197pi = points[i];1198px.push(pi[0]);1199py.push(pi[1]);1200}1201path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));1202--i;1203while (++i < n) {1204pi = points[i];1205px.shift();1206px.push(pi[0]);1207py.shift();1208py.push(pi[1]);1209d3_svg_lineBasisBezier(path, px, py);1210}1211return path.join("");1212}1213function d3_svg_lineBasisClosed(points) {1214var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];1215while (++i < 4) {1216pi = points[i % n];1217px.push(pi[0]);1218py.push(pi[1]);1219}1220path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];1221--i;1222while (++i < m) {1223pi = points[i % n];1224px.shift();1225px.push(pi[0]);1226py.shift();1227py.push(pi[1]);1228d3_svg_lineBasisBezier(path, px, py);1229}1230return path.join("");1231}1232function d3_svg_lineBundle(points, tension) {1233var n = points.length - 1;1234if (n) {1235var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;1236while (++i <= n) {1237p = points[i];1238t = i / n;1239p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);1240p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);1241}1242}1243return d3_svg_lineBasis(points);1244}1245function d3_svg_lineDot4(a, b) {1246return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];1247}1248function d3_svg_lineBasisBezier(path, x, y) {1249path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));1250}1251function d3_svg_lineSlope(p0, p1) {1252return (p1[1] - p0[1]) / (p1[0] - p0[0]);1253}1254function d3_svg_lineFiniteDifferences(points) {1255var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);1256while (++i < j) {1257m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;1258}1259m[i] = d;1260return m;1261}1262function d3_svg_lineMonotoneTangents(points) {1263var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;1264while (++i < j) {1265d = d3_svg_lineSlope(points[i], points[i + 1]);1266if (Math.abs(d) < 1e-6) {1267m[i] = m[i + 1] = 0;1268} else {1269a = m[i] / d;1270b = m[i + 1] / d;1271s = a * a + b * b;1272if (s > 9) {1273s = d * 3 / Math.sqrt(s);1274m[i] = s * a;1275m[i + 1] = s * b;1276}1277}1278}1279i = -1;1280while (++i <= j) {1281s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));1282tangents.push([ s || 0, m[i] * s || 0 ]);1283}1284return tangents;1285}1286function d3_svg_lineMonotone(points) {1287return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));1288}1289function d3_svg_lineRadial(points) {1290var point, i = -1, n = points.length, r, a;1291while (++i < n) {1292point = points[i];1293r = point[0];1294a = point[1] + d3_svg_arcOffset;1295point[0] = r * Math.cos(a);1296point[1] = r * Math.sin(a);1297}1298return points;1299}1300function d3_svg_area(projection) {1301function area(data) {1302function segment() {1303segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");1304}1305var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {1306return x;1307} : d3_functor(x1), fy1 = y0 === y1 ? function() {1308return y;1309} : d3_functor(y1), x, y;1310while (++i < n) {1311if (defined.call(this, d = data[i], i)) {1312points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);1313points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);1314} else if (points0.length) {1315segment();1316points0 = [];1317points1 = [];1318}1319}1320if (points0.length) segment();1321return segments.length ? segments.join("") : null;1322}1323var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;1324area.x = function(_) {1325if (!arguments.length) return x1;1326x0 = x1 = _;1327return area;1328};1329area.x0 = function(_) {1330if (!arguments.length) return x0;1331x0 = _;1332return area;1333};1334area.x1 = function(_) {1335if (!arguments.length) return x1;1336x1 = _;1337return area;1338};1339area.y = function(_) {1340if (!arguments.length) return y1;1341y0 = y1 = _;1342return area;1343};1344area.y0 = function(_) {1345if (!arguments.length) return y0;1346y0 = _;1347return area;1348};1349area.y1 = function(_) {1350if (!arguments.length) return y1;1351y1 = _;1352return area;1353};1354area.defined = function(_) {1355if (!arguments.length) return defined;1356defined = _;1357return area;1358};1359area.interpolate = function(_) {1360if (!arguments.length) return interpolateKey;1361if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;1362interpolateReverse = interpolate.reverse || interpolate;1363L = interpolate.closed ? "M" : "L";1364return area;1365};1366area.tension = function(_) {1367if (!arguments.length) return tension;1368tension = _;1369return area;1370};1371return area;1372}1373function d3_svg_chordSource(d) {1374return d.source;1375}1376function d3_svg_chordTarget(d) {1377return d.target;1378}1379function d3_svg_chordRadius(d) {1380return d.radius;1381}1382function d3_svg_chordStartAngle(d) {1383return d.startAngle;1384}1385function d3_svg_chordEndAngle(d) {1386return d.endAngle;1387}1388function d3_svg_diagonalProjection(d) {1389return [ d.x, d.y ];1390}1391function d3_svg_diagonalRadialProjection(projection) {1392return function() {1393var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;1394return [ r * Math.cos(a), r * Math.sin(a) ];1395};1396}1397function d3_svg_symbolSize() {1398return 64;1399}1400function d3_svg_symbolType() {1401return "circle";1402}1403function d3_svg_symbolCircle(size) {1404var r = Math.sqrt(size / Math.PI);1405return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";1406}1407function d3_svg_axisX(selection, x) {1408selection.attr("transform", function(d) {1409return "translate(" + x(d) + ",0)";1410});1411}1412function d3_svg_axisY(selection, y) {1413selection.attr("transform", function(d) {1414return "translate(0," + y(d) + ")";1415});1416}1417function d3_svg_axisSubdivide(scale, ticks, m) {1418subticks = [];1419if (m && ticks.length > 1) {1420var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;1421while (++i < n) {1422for (j = m; --j > 0; ) {1423if ((v = +ticks[i] - j * d) >= extent[0]) {1424subticks.push(v);1425}1426}1427}1428for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {1429subticks.push(v);1430}1431}1432return subticks;1433}1434function d3_behavior_zoomDelta() {1435if (!d3_behavior_zoomDiv) {1436d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode;1437}1438var e = d3.event, delta;1439try {1440d3_behavior_zoomDiv.scrollTop = 1e3;1441d3_behavior_zoomDiv.dispatchEvent(e);1442delta = 1e3 - d3_behavior_zoomDiv.scrollTop;1443} catch (error) {1444delta = e.wheelDelta || -e.detail * 5;1445}1446return delta;1447}1448function d3_layout_bundlePath(link) {1449var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];1450while (start !== lca) {1451start = start.parent;1452points.push(start);1453}1454var k = points.length;1455while (end !== lca) {1456points.splice(k, 0, end);1457end = end.parent;1458}1459return points;1460}1461function d3_layout_bundleAncestors(node) {1462var ancestors = [], parent = node.parent;1463while (parent != null) {1464ancestors.push(node);1465node = parent;1466parent = parent.parent;1467}1468ancestors.push(node);1469return ancestors;1470}1471function d3_layout_bundleLeastCommonAncestor(a, b) {1472if (a === b) return a;1473var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;1474while (aNode === bNode) {1475sharedNode = aNode;1476aNode = aNodes.pop();1477bNode = bNodes.pop();1478}1479return sharedNode;1480}1481function d3_layout_forceDragstart(d) {1482d.fixed |= 2;1483}1484function d3_layout_forceDragend(d) {1485d.fixed &= 1;1486}1487function d3_layout_forceMouseover(d) {1488d.fixed |= 4;1489}1490function d3_layout_forceMouseout(d) {1491d.fixed &= 3;1492}1493function d3_layout_forceAccumulate(quad, alpha, charges) {1494var cx = 0, cy = 0;1495quad.charge = 0;1496if (!quad.leaf) {1497var nodes = quad.nodes, n = nodes.length, i = -1, c;1498while (++i < n) {1499c = nodes[i];1500if (c == null) continue;1501d3_layout_forceAccumulate(c, alpha, charges);1502quad.charge += c.charge;1503cx += c.charge * c.cx;1504cy += c.charge * c.cy;1505}1506}1507if (quad.point) {1508if (!quad.leaf) {1509quad.point.x += Math.random() - .5;1510quad.point.y += Math.random() - .5;1511}1512var k = alpha * charges[quad.point.index];1513quad.charge += quad.pointCharge = k;1514cx += k * quad.point.x;1515cy += k * quad.point.y;1516}1517quad.cx = cx / quad.charge;1518quad.cy = cy / quad.charge;1519}1520function d3_layout_forceLinkDistance(link) {1521return 20;1522}1523function d3_layout_forceLinkStrength(link) {1524return 1;1525}1526function d3_layout_stackX(d) {1527return d.x;1528}1529function d3_layout_stackY(d) {1530return d.y;1531}1532function d3_layout_stackOut(d, y0, y) {1533d.y0 = y0;1534d.y = y;1535}1536function d3_layout_stackOrderDefault(data) {1537return d3.range(data.length);1538}1539function d3_layout_stackOffsetZero(data) {1540var j = -1, m = data[0].length, y0 = [];1541while (++j < m) y0[j] = 0;1542return y0;1543}1544function d3_layout_stackMaxIndex(array) {1545var i = 1, j = 0, v = array[0][1], k, n = array.length;1546for (; i < n; ++i) {1547if ((k = array[i][1]) > v) {1548j = i;1549v = k;1550}1551}1552return j;1553}1554function d3_layout_stackReduceSum(d) {1555return d.reduce(d3_layout_stackSum, 0);1556}1557function d3_layout_stackSum(p, d) {1558return p + d[1];1559}1560function d3_layout_histogramBinSturges(range, values) {1561return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));1562}1563function d3_layout_histogramBinFixed(range, n) {1564var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];1565while (++x <= n) f[x] = m * x + b;1566return f;1567}1568function d3_layout_histogramRange(values) {1569return [ d3.min(values), d3.max(values) ];1570}1571function d3_layout_hierarchyRebind(object, hierarchy) {1572d3.rebind(object, hierarchy, "sort", "children", "value");1573object.links = d3_layout_hierarchyLinks;1574object.nodes = function(d) {1575d3_layout_hierarchyInline = true;1576return (object.nodes = object)(d);1577};1578return object;1579}1580function d3_layout_hierarchyChildren(d) {1581return d.children;1582}1583function d3_layout_hierarchyValue(d) {1584return d.value;1585}1586function d3_layout_hierarchySort(a, b) {1587return b.value - a.value;1588}1589function d3_layout_hierarchyLinks(nodes) {1590return d3.merge(nodes.map(function(parent) {1591return (parent.children || []).map(function(child) {1592return {1593source: parent,1594target: child1595};1596});1597}));1598}1599function d3_layout_packSort(a, b) {1600return a.value - b.value;1601}1602function d3_layout_packInsert(a, b) {1603var c = a._pack_next;1604a._pack_next = b;1605b._pack_prev = a;1606b._pack_next = c;1607c._pack_prev = b;1608}1609function d3_layout_packSplice(a, b) {1610a._pack_next = b;1611b._pack_prev = a;1612}1613function d3_layout_packIntersects(a, b) {1614var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;1615return dr * dr - dx * dx - dy * dy > .001;1616}1617function d3_layout_packSiblings(node) {1618function bound(node) {1619xMin = Math.min(node.x - node.r, xMin);1620xMax = Math.max(node.x + node.r, xMax);1621yMin = Math.min(node.y - node.r, yMin);1622yMax = Math.max(node.y + node.r, yMax);1623}1624if (!(nodes = node.children) || !(n = nodes.length)) return;1625var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;1626nodes.forEach(d3_layout_packLink);1627a = nodes[0];1628a.x = -a.r;1629a.y = 0;1630bound(a);1631if (n > 1) {1632b = nodes[1];1633b.x = b.r;1634b.y = 0;1635bound(b);1636if (n > 2) {1637c = nodes[2];1638d3_layout_packPlace(a, b, c);1639bound(c);1640d3_layout_packInsert(a, c);1641a._pack_prev = c;1642d3_layout_packInsert(c, b);1643b = a._pack_next;1644for (i = 3; i < n; i++) {1645d3_layout_packPlace(a, b, c = nodes[i]);1646var isect = 0, s1 = 1, s2 = 1;1647for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {1648if (d3_layout_packIntersects(j, c)) {1649isect = 1;1650break;1651}1652}1653if (isect == 1) {1654for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {1655if (d3_layout_packIntersects(k, c)) {1656break;1657}1658}1659}1660if (isect) {1661if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);1662i--;1663} else {1664d3_layout_packInsert(a, c);1665b = c;1666bound(c);1667}1668}1669}1670}1671var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;1672for (i = 0; i < n; i++) {1673c = nodes[i];1674c.x -= cx;1675c.y -= cy;1676cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));1677}1678node.r = cr;1679nodes.forEach(d3_layout_packUnlink);1680}1681function d3_layout_packLink(node) {1682node._pack_next = node._pack_prev = node;1683}1684function d3_layout_packUnlink(node) {1685delete node._pack_next;1686delete node._pack_prev;1687}1688function d3_layout_packTransform(node, x, y, k) {1689var children = node.children;1690node.x = x += k * node.x;1691node.y = y += k * node.y;1692node.r *= k;1693if (children) {1694var i = -1, n = children.length;1695while (++i < n) d3_layout_packTransform(children[i], x, y, k);1696}1697}1698function d3_layout_packPlace(a, b, c) {1699var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;1700if (db && (dx || dy)) {1701var da = b.r + c.r, dc = dx * dx + dy * dy;1702da *= da;1703db *= db;1704var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);1705c.x = a.x + x * dx + y * dy;1706c.y = a.y + x * dy - y * dx;1707} else {1708c.x = a.x + db;1709c.y = a.y;1710}1711}1712function d3_layout_clusterY(children) {1713return 1 + d3.max(children, function(child) {1714return child.y;1715});1716}1717function d3_layout_clusterX(children) {1718return children.reduce(function(x, child) {1719return x + child.x;1720}, 0) / children.length;1721}1722function d3_layout_clusterLeft(node) {1723var children = node.children;1724return children && children.length ? d3_layout_clusterLeft(children[0]) : node;1725}1726function d3_layout_clusterRight(node) {1727var children = node.children, n;1728return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;1729}1730function d3_layout_treeSeparation(a, b) {1731return a.parent == b.parent ? 1 : 2;1732}1733function d3_layout_treeLeft(node) {1734var children = node.children;1735return children && children.length ? children[0] : node._tree.thread;1736}1737function d3_layout_treeRight(node) {1738var children = node.children, n;1739return children && (n = children.length) ? children[n - 1] : node._tree.thread;1740}1741function d3_layout_treeSearch(node, compare) {1742var children = node.children;1743if (children && (n = children.length)) {1744var child, n, i = -1;1745while (++i < n) {1746if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {1747node = child;1748}1749}1750}1751return node;1752}1753function d3_layout_treeRightmost(a, b) {1754return a.x - b.x;1755}1756function d3_layout_treeLeftmost(a, b) {1757return b.x - a.x;1758}1759function d3_layout_treeDeepest(a, b) {1760return a.depth - b.depth;1761}1762function d3_layout_treeVisitAfter(node, callback) {1763function visit(node, previousSibling) {1764var children = node.children;1765if (children && (n = children.length)) {1766var child, previousChild = null, i = -1, n;1767while (++i < n) {1768child = children[i];1769visit(child, previousChild);1770previousChild = child;1771}1772}1773callback(node, previousSibling);1774}1775visit(node, null);1776}1777function d3_layout_treeShift(node) {1778var shift = 0, change = 0, children = node.children, i = children.length, child;1779while (--i >= 0) {1780child = children[i]._tree;1781child.prelim += shift;1782child.mod += shift;1783shift += child.shift + (change += child.change);1784}1785}1786function d3_layout_treeMove(ancestor, node, shift) {1787ancestor = ancestor._tree;1788node = node._tree;1789var change = shift / (node.number - ancestor.number);1790ancestor.change += change;1791node.change -= change;1792node.shift += shift;1793node.prelim += shift;1794node.mod += shift;1795}1796function d3_layout_treeAncestor(vim, node, ancestor) {1797return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;1798}1799function d3_layout_treemapPadNull(node) {1800return {1801x: node.x,1802y: node.y,1803dx: node.dx,1804dy: node.dy1805};1806}1807function d3_layout_treemapPad(node, padding) {1808var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];1809if (dx < 0) {1810x += dx / 2;1811dx = 0;1812}1813if (dy < 0) {1814y += dy / 2;1815dy = 0;1816}1817return {1818x: x,1819y: y,1820dx: dx,1821dy: dy1822};1823}1824function d3_dsv(delimiter, mimeType) {1825function dsv(url, callback) {1826d3.text(url, mimeType, function(text) {1827callback(text && dsv.parse(text));1828});1829}1830function formatRow(row) {1831return row.map(formatValue).join(delimiter);1832}1833function formatValue(text) {1834return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;1835}1836var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);1837dsv.parse = function(text) {1838var header;1839return dsv.parseRows(text, function(row, i) {1840if (i) {1841var o = {}, j = -1, m = header.length;1842while (++j < m) o[header[j]] = row[j];1843return o;1844} else {1845header = row;1846return null;1847}1848});1849};1850dsv.parseRows = function(text, f) {1851function token() {1852if (reParse.lastIndex >= text.length) return EOF;1853if (eol) {1854eol = false;1855return EOL;1856}1857var j = reParse.lastIndex;1858if (text.charCodeAt(j) === 34) {1859var i = j;1860while (i++ < text.length) {1861if (text.charCodeAt(i) === 34) {1862if (text.charCodeAt(i + 1) !== 34) break;1863i++;1864}1865}1866reParse.lastIndex = i + 2;1867var c = text.charCodeAt(i + 1);1868if (c === 13) {1869eol = true;1870if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++;1871} else if (c === 10) {1872eol = true;1873}1874return text.substring(j + 1, i).replace(/""/g, '"');1875}1876var m = reParse.exec(text);1877if (m) {1878eol = m[0].charCodeAt(0) !== delimiterCode;1879return text.substring(j, m.index);1880}1881reParse.lastIndex = text.length;1882return text.substring(j);1883}1884var EOL = {}, EOF = {}, rows = [], n = 0, t, eol;1885reParse.lastIndex = 0;1886while ((t = token()) !== EOF) {1887var a = [];1888while (t !== EOL && t !== EOF) {1889a.push(t);1890t = token();1891}1892if (f && !(a = f(a, n++))) continue;1893rows.push(a);1894}1895return rows;1896};1897dsv.format = function(rows) {1898return rows.map(formatRow).join("\n");1899};1900return dsv;1901}1902function d3_geo_type(types, defaultValue) {1903return function(object) {1904return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;1905};1906}1907function d3_path_circle(radius) {1908return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";1909}1910function d3_geo_bounds(o, f) {1911if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);1912}1913function d3_geo_boundsFeature(o, f) {1914d3_geo_bounds(o.geometry, f);1915}1916function d3_geo_boundsFeatureCollection(o, f) {1917for (var a = o.features, i = 0, n = a.length; i < n; i++) {1918d3_geo_bounds(a[i].geometry, f);1919}1920}1921function d3_geo_boundsGeometryCollection(o, f) {1922for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {1923d3_geo_bounds(a[i], f);1924}1925}1926function d3_geo_boundsLineString(o, f) {1927for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {1928f.apply(null, a[i]);1929}1930}1931function d3_geo_boundsMultiLineString(o, f) {1932for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {1933for (var b = a[i], j = 0, m = b.length; j < m; j++) {1934f.apply(null, b[j]);1935}1936}1937}1938function d3_geo_boundsMultiPolygon(o, f) {1939for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {1940for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {1941f.apply(null, b[j]);1942}1943}1944}1945function d3_geo_boundsPoint(o, f) {1946f.apply(null, o.coordinates);1947}1948function d3_geo_boundsPolygon(o, f) {1949for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {1950f.apply(null, a[i]);1951}1952}1953function d3_geo_greatArcSource(d) {1954return d.source;1955}1956function d3_geo_greatArcTarget(d) {1957return d.target;1958}1959function d3_geo_greatArcInterpolator() {1960function interpolate(t) {1961var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;1962return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];1963}1964var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k;1965interpolate.distance = function() {1966if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));1967return d;1968};1969interpolate.source = function(_) {1970var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0);1971cy0 = Math.cos(y0 = _[1] * d3_geo_radians);1972sy0 = Math.sin(y0);1973kx0 = cy0 * cx0;1974ky0 = cy0 * sx0;1975d = null;1976return interpolate;1977};1978interpolate.target = function(_) {1979var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1);1980cy1 = Math.cos(y1 = _[1] * d3_geo_radians);1981sy1 = Math.sin(y1);1982kx1 = cy1 * cx1;1983ky1 = cy1 * sx1;1984d = null;1985return interpolate;1986};1987return interpolate;1988}1989function d3_geo_greatArcInterpolate(a, b) {1990var i = d3_geo_greatArcInterpolator().source(a).target(b);1991i.distance();1992return i;1993}1994function d3_geom_contourStart(grid) {1995var x = 0, y = 0;1996while (true) {1997if (grid(x, y)) {1998return [ x, y ];1999}2000if (x === 0) {2001x = y + 1;2002y = 0;2003} else {2004x = x - 1;2005y = y + 1;2006}2007}2008}2009function d3_geom_hullCCW(i1, i2, i3, v) {2010var t, a, b, c, d, e, f;2011t = v[i1];2012a = t[0];2013b = t[1];2014t = v[i2];2015c = t[0];2016d = t[1];2017t = v[i3];2018e = t[0];2019f = t[1];2020return (f - b) * (c - a) - (d - b) * (e - a) > 0;2021}2022function d3_geom_polygonInside(p, a, b) {2023return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);2024}2025function d3_geom_polygonIntersect(c, d, a, b) {2026var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);2027return [ x1 + ua * x21, y1 + ua * y21 ];2028}2029function d3_voronoi_tessellate(vertices, callback) {2030var Sites = {2031list: vertices.map(function(v, i) {2032return {2033index: i,2034x: v[0],2035y: v[1]2036};2037}).sort(function(a, b) {2038return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;2039}),2040bottomSite: null2041};2042var EdgeList = {2043list: [],2044leftEnd: null,2045rightEnd: null,2046init: function() {2047EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");2048EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");2049EdgeList.leftEnd.r = EdgeList.rightEnd;2050EdgeList.rightEnd.l = EdgeList.leftEnd;2051EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);2052},2053createHalfEdge: function(edge, side) {2054return {2055edge: edge,2056side: side,2057vertex: null,2058l: null,2059r: null2060};2061},2062insert: function(lb, he) {2063he.l = lb;2064he.r = lb.r;2065lb.r.l = he;2066lb.r = he;2067},2068leftBound: function(p) {2069var he = EdgeList.leftEnd;2070do {2071he = he.r;2072} while (he != EdgeList.rightEnd && Geom.rightOf(he, p));2073he = he.l;2074return he;2075},2076del: function(he) {2077he.l.r = he.r;2078he.r.l = he.l;2079he.edge = null;2080},2081right: function(he) {2082return he.r;2083},2084left: function(he) {2085return he.l;2086},2087leftRegion: function(he) {2088return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];2089},2090rightRegion: function(he) {2091return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];2092}2093};2094var Geom = {2095bisect: function(s1, s2) {2096var newEdge = {2097region: {2098l: s1,2099r: s22100},2101ep: {2102l: null,2103r: null2104}2105};2106var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;2107newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;2108if (adx > ady) {2109newEdge.a = 1;2110newEdge.b = dy / dx;2111newEdge.c /= dx;2112} else {2113newEdge.b = 1;2114newEdge.a = dx / dy;2115newEdge.c /= dy;2116}2117return newEdge;2118},2119intersect: function(el1, el2) {2120var e1 = el1.edge, e2 = el2.edge;2121if (!e1 || !e2 || e1.region.r == e2.region.r) {2122return null;2123}2124var d = e1.a * e2.b - e1.b * e2.a;2125if (Math.abs(d) < 1e-10) {2126return null;2127}2128var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;2129if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {2130el = el1;2131e = e1;2132} else {2133el = el2;2134e = e2;2135}2136var rightOfSite = xint >= e.region.r.x;2137if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {2138return null;2139}2140return {2141x: xint,2142y: yint2143};2144},2145rightOf: function(he, p) {2146var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;2147if (rightOfSite && he.side === "l") {2148return 1;2149}2150if (!rightOfSite && he.side === "r") {2151return 0;2152}2153if (e.a === 1) {2154var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;2155if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {2156above = fast = dyp >= e.b * dxp;2157} else {2158above = p.x + p.y * e.b > e.c;2159if (e.b < 0) {2160above = !above;2161}2162if (!above) {2163fast = 1;2164}2165}2166if (!fast) {2167var dxs = topsite.x - e.region.l.x;2168above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);2169if (e.b < 0) {2170above = !above;2171}2172}2173} else {2174var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;2175above = t1 * t1 > t2 * t2 + t3 * t3;2176}2177return he.side === "l" ? above : !above;2178},2179endPoint: function(edge, side, site) {2180edge.ep[side] = site;2181if (!edge.ep[d3_voronoi_opposite[side]]) return;2182callback(edge);2183},2184distance: function(s, t) {2185var dx = s.x - t.x, dy = s.y - t.y;2186return Math.sqrt(dx * dx + dy * dy);2187}2188};2189var EventQueue = {2190list: [],2191insert: function(he, site, offset) {2192he.vertex = site;2193he.ystar = site.y + offset;2194for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {2195var next = list[i];2196if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {2197continue;2198} else {2199break;2200}2201}2202list.splice(i, 0, he);2203},2204del: function(he) {2205for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}2206ls.splice(i, 1);2207},2208empty: function() {2209return EventQueue.list.length === 0;2210},2211nextEvent: function(he) {2212for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {2213if (ls[i] == he) return ls[i + 1];2214}2215return null;2216},2217min: function() {2218var elem = EventQueue.list[0];2219return {2220x: elem.vertex.x,2221y: elem.ystar2222};2223},2224extractMin: function() {2225return EventQueue.list.shift();2226}2227};2228EdgeList.init();2229Sites.bottomSite = Sites.list.shift();2230var newSite = Sites.list.shift(), newIntStar;2231var lbnd, rbnd, llbnd, rrbnd, bisector;2232var bot, top, temp, p, v;2233var e, pm;2234while (true) {2235if (!EventQueue.empty()) {2236newIntStar = EventQueue.min();2237}2238if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {2239lbnd = EdgeList.leftBound(newSite);2240rbnd = EdgeList.right(lbnd);2241bot = EdgeList.rightRegion(lbnd);2242e = Geom.bisect(bot, newSite);2243bisector = EdgeList.createHalfEdge(e, "l");2244EdgeList.insert(lbnd, bisector);2245p = Geom.intersect(lbnd, bisector);2246if (p) {2247EventQueue.del(lbnd);2248EventQueue.insert(lbnd, p, Geom.distance(p, newSite));2249}2250lbnd = bisector;2251bisector = EdgeList.createHalfEdge(e, "r");2252EdgeList.insert(lbnd, bisector);2253p = Geom.intersect(bisector, rbnd);2254if (p) {2255EventQueue.insert(bisector, p, Geom.distance(p, newSite));2256}2257newSite = Sites.list.shift();2258} else if (!EventQueue.empty()) {2259lbnd = EventQueue.extractMin();2260llbnd = EdgeList.left(lbnd);2261rbnd = EdgeList.right(lbnd);2262rrbnd = EdgeList.right(rbnd);2263bot = EdgeList.leftRegion(lbnd);2264top = EdgeList.rightRegion(rbnd);2265v = lbnd.vertex;2266Geom.endPoint(lbnd.edge, lbnd.side, v);2267Geom.endPoint(rbnd.edge, rbnd.side, v);2268EdgeList.del(lbnd);2269EventQueue.del(rbnd);2270EdgeList.del(rbnd);2271pm = "l";2272if (bot.y > top.y) {2273temp = bot;2274bot = top;2275top = temp;2276pm = "r";2277}2278e = Geom.bisect(bot, top);2279bisector = EdgeList.createHalfEdge(e, pm);2280EdgeList.insert(llbnd, bisector);2281Geom.endPoint(e, d3_voronoi_opposite[pm], v);2282p = Geom.intersect(llbnd, bisector);2283if (p) {2284EventQueue.del(llbnd);2285EventQueue.insert(llbnd, p, Geom.distance(p, bot));2286}2287p = Geom.intersect(bisector, rrbnd);2288if (p) {2289EventQueue.insert(bisector, p, Geom.distance(p, bot));2290}2291} else {2292break;2293}2294}2295for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {2296callback(lbnd.edge);2297}2298}2299function d3_geom_quadtreeNode() {2300return {2301leaf: true,2302nodes: [],2303point: null2304};2305}2306function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {2307if (!f(node, x1, y1, x2, y2)) {2308var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;2309if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);2310if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);2311if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);2312if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);2313}2314}2315function d3_geom_quadtreePoint(p) {2316return {2317x: p[0],2318y: p[1]2319};2320}2321function d3_time_utc() {2322this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);2323}2324function d3_time_formatAbbreviate(name) {2325return name.substring(0, 3);2326}2327function d3_time_parse(date, template, string, j) {2328var c, p, i = 0, n = template.length, m = string.length;2329while (i < n) {2330if (j >= m) return -1;2331c = template.charCodeAt(i++);2332if (c == 37) {2333p = d3_time_parsers[template.charAt(i++)];2334if (!p || (j = p(date, string, j)) < 0) return -1;2335} else if (c != string.charCodeAt(j++)) {2336return -1;2337}2338}2339return j;2340}2341function d3_time_formatRe(names) {2342return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");2343}2344function d3_time_formatLookup(names) {2345var map = new d3_Map, i = -1, n = names.length;2346while (++i < n) map.set(names[i].toLowerCase(), i);2347return map;2348}2349function d3_time_parseWeekdayAbbrev(date, string, i) {2350d3_time_dayAbbrevRe.lastIndex = 0;2351var n = d3_time_dayAbbrevRe.exec(string.substring(i));2352return n ? i += n[0].length : -1;2353}2354function d3_time_parseWeekday(date, string, i) {2355d3_time_dayRe.lastIndex = 0;2356var n = d3_time_dayRe.exec(string.substring(i));2357return n ? i += n[0].length : -1;2358}2359function d3_time_parseMonthAbbrev(date, string, i) {2360d3_time_monthAbbrevRe.lastIndex = 0;2361var n = d3_time_monthAbbrevRe.exec(string.substring(i));2362return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;2363}2364function d3_time_parseMonth(date, string, i) {2365d3_time_monthRe.lastIndex = 0;2366var n = d3_time_monthRe.exec(string.substring(i));2367return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;2368}2369function d3_time_parseLocaleFull(date, string, i) {2370return d3_time_parse(date, d3_time_formats.c.toString(), string, i);2371}2372function d3_time_parseLocaleDate(date, string, i) {2373return d3_time_parse(date, d3_time_formats.x.toString(), string, i);2374}2375function d3_time_parseLocaleTime(date, string, i) {2376return d3_time_parse(date, d3_time_formats.X.toString(), string, i);2377}2378function d3_time_parseFullYear(date, string, i) {2379d3_time_numberRe.lastIndex = 0;2380var n = d3_time_numberRe.exec(string.substring(i, i + 4));2381return n ? (date.y = +n[0], i += n[0].length) : -1;2382}2383function d3_time_parseYear(date, string, i) {2384d3_time_numberRe.lastIndex = 0;2385var n = d3_time_numberRe.exec(string.substring(i, i + 2));2386return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;2387}2388function d3_time_expandYear(d) {2389return d + (d > 68 ? 1900 : 2e3);2390}2391function d3_time_parseMonthNumber(date, string, i) {2392d3_time_numberRe.lastIndex = 0;2393var n = d3_time_numberRe.exec(string.substring(i, i + 2));2394return n ? (date.m = n[0] - 1, i += n[0].length) : -1;2395}2396function d3_time_parseDay(date, string, i) {2397d3_time_numberRe.lastIndex = 0;2398var n = d3_time_numberRe.exec(string.substring(i, i + 2));2399return n ? (date.d = +n[0], i += n[0].length) : -1;2400}2401function d3_time_parseHour24(date, string, i) {2402d3_time_numberRe.lastIndex = 0;2403var n = d3_time_numberRe.exec(string.substring(i, i + 2));2404return n ? (date.H = +n[0], i += n[0].length) : -1;2405}2406function d3_time_parseMinutes(date, string, i) {2407d3_time_numberRe.lastIndex = 0;2408var n = d3_time_numberRe.exec(string.substring(i, i + 2));2409return n ? (date.M = +n[0], i += n[0].length) : -1;2410}2411function d3_time_parseSeconds(date, string, i) {2412d3_time_numberRe.lastIndex = 0;2413var n = d3_time_numberRe.exec(string.substring(i, i + 2));2414return n ? (date.S = +n[0], i += n[0].length) : -1;2415}2416function d3_time_parseMilliseconds(date, string, i) {2417d3_time_numberRe.lastIndex = 0;2418var n = d3_time_numberRe.exec(string.substring(i, i + 3));2419return n ? (date.L = +n[0], i += n[0].length) : -1;2420}2421function d3_time_parseAmPm(date, string, i) {2422var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());2423return n == null ? -1 : (date.p = n, i);2424}2425function d3_time_zone(d) {2426var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;2427return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);2428}2429function d3_time_formatIsoNative(date) {2430return date.toISOString();2431}2432function d3_time_interval(local, step, number) {2433function round(date) {2434var d0 = local(date), d1 = offset(d0, 1);2435return date - d0 < d1 - date ? d0 : d1;2436}2437function ceil(date) {2438step(date = local(new d3_time(date - 1)), 1);2439return date;2440}2441function offset(date, k) {2442step(date = new d3_time(+date), k);2443return date;2444}2445function range(t0, t1, dt) {2446var time = ceil(t0), times = [];2447if (dt > 1) {2448while (time < t1) {2449if (!(number(time) % dt)) times.push(new Date(+time));2450step(time, 1);2451}2452} else {2453while (time < t1) times.push(new Date(+time)), step(time, 1);2454}2455return times;2456}2457function range_utc(t0, t1, dt) {2458try {2459d3_time = d3_time_utc;2460var utc = new d3_time_utc;2461utc._ = t0;2462return range(utc, t1, dt);2463} finally {2464d3_time = Date;2465}2466}2467local.floor = local;2468local.round = round;2469local.ceil = ceil;2470local.offset = offset;2471local.range = range;2472var utc = local.utc = d3_time_interval_utc(local);2473utc.floor = utc;2474utc.round = d3_time_interval_utc(round);2475utc.ceil = d3_time_interval_utc(ceil);2476utc.offset = d3_time_interval_utc(offset);2477utc.range = range_utc;2478return local;2479}2480function d3_time_interval_utc(method) {2481return function(date, k) {2482try {2483d3_time = d3_time_utc;2484var utc = new d3_time_utc;2485utc._ = date;2486return method(utc, k)._;2487} finally {2488d3_time = Date;2489}2490};2491}2492function d3_time_scale(linear, methods, format) {2493function scale(x) {2494return linear(x);2495}2496scale.invert = function(x) {2497return d3_time_scaleDate(linear.invert(x));2498};2499scale.domain = function(x) {2500if (!arguments.length) return linear.domain().map(d3_time_scaleDate);2501linear.domain(x);2502return scale;2503};2504scale.nice = function(m) {2505return scale.domain(d3_scale_nice(scale.domain(), function() {2506return m;2507}));2508};2509scale.ticks = function(m, k) {2510var extent = d3_time_scaleExtent(scale.domain());2511if (typeof m !== "function") {2512var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);2513if (i == d3_time_scaleSteps.length) return methods.year(extent, m);2514if (!i) return linear.ticks(m).map(d3_time_scaleDate);2515if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;2516m = methods[i];2517k = m[1];2518m = m[0].range;2519}2520return m(extent[0], new Date(+extent[1] + 1), k);2521};2522scale.tickFormat = function() {2523return format;2524};2525scale.copy = function() {2526return d3_time_scale(linear.copy(), methods, format);2527};2528return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");2529}2530function d3_time_scaleExtent(domain) {2531var start = domain[0], stop = domain[domain.length - 1];2532return start < stop ? [ start, stop ] : [ stop, start ];2533}2534function d3_time_scaleDate(t) {2535return new Date(t);2536}2537function d3_time_scaleFormat(formats) {2538return function(date) {2539var i = formats.length - 1, f = formats[i];2540while (!f[1](date)) f = formats[--i];2541return f[0](date);2542};2543}2544function d3_time_scaleSetYear(y) {2545var d = new Date(y, 0, 1);2546d.setFullYear(y);2547return d;2548}2549function d3_time_scaleGetYear(d) {2550var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);2551return y + (d - d0) / (d1 - d0);2552}2553function d3_time_scaleUTCSetYear(y) {2554var d = new Date(Date.UTC(y, 0, 1));2555d.setUTCFullYear(y);2556return d;2557}2558function d3_time_scaleUTCGetYear(d) {2559var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);2560return y + (d - d0) / (d1 - d0);2561}2562if (!Date.now) Date.now = function() {2563return +(new Date);2564};2565try {2566document.createElement("div").style.setProperty("opacity", 0, "");2567} catch (error) {2568var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;2569d3_style_prototype.setProperty = function(name, value, priority) {2570d3_style_setProperty.call(this, name, value + "", priority);2571};2572}2573d3 = {2574version: "2.10.2"2575};2576var d3_array = d3_arraySlice;2577try {2578d3_array(document.documentElement.childNodes)[0].nodeType;2579} catch (e) {2580d3_array = d3_arrayCopy;2581}2582var d3_arraySubclass = [].__proto__ ? function(array, prototype) {2583array.__proto__ = prototype;2584} : function(array, prototype) {2585for (var property in prototype) array[property] = prototype[property];2586};2587d3.map = function(object) {2588var map = new d3_Map;2589for (var key in object) map.set(key, object[key]);2590return map;2591};2592d3_class(d3_Map, {2593has: function(key) {2594return d3_map_prefix + key in this;2595},2596get: function(key) {2597return this[d3_map_prefix + key];2598},2599set: function(key, value) {2600return this[d3_map_prefix + key] = value;2601},2602remove: function(key) {2603key = d3_map_prefix + key;2604return key in this && delete this[key];2605},2606keys: function() {2607var keys = [];2608this.forEach(function(key) {2609keys.push(key);2610});2611return keys;2612},2613values: function() {2614var values = [];2615this.forEach(function(key, value) {2616values.push(value);2617});2618return values;2619},2620entries: function() {2621var entries = [];2622this.forEach(function(key, value) {2623entries.push({2624key: key,2625value: value2626});2627});2628return entries;2629},2630forEach: function(f) {2631for (var key in this) {2632if (key.charCodeAt(0) === d3_map_prefixCode) {2633f.call(this, key.substring(1), this[key]);2634}2635}2636}2637});2638var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);2639d3.functor = d3_functor;2640d3.rebind = function(target, source) {2641var i = 1, n = arguments.length, method;2642while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);2643return target;2644};2645d3.ascending = function(a, b) {2646return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;2647};2648d3.descending = function(a, b) {2649return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;2650};2651d3.mean = function(array, f) {2652var n = array.length, a, m = 0, i = -1, j = 0;2653if (arguments.length === 1) {2654while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;2655} else {2656while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;2657}2658return j ? m : undefined;2659};2660d3.median = function(array, f) {2661if (arguments.length > 1) array = array.map(f);2662array = array.filter(d3_number);2663return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;2664};2665d3.min = function(array, f) {2666var i = -1, n = array.length, a, b;2667if (arguments.length === 1) {2668while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;2669while (++i < n) if ((b = array[i]) != null && a > b) a = b;2670} else {2671while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;2672while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;2673}2674return a;2675};2676d3.max = function(array, f) {2677var i = -1, n = array.length, a, b;2678if (arguments.length === 1) {2679while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;2680while (++i < n) if ((b = array[i]) != null && b > a) a = b;2681} else {2682while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;2683while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;2684}2685return a;2686};2687d3.extent = function(array, f) {2688var i = -1, n = array.length, a, b, c;2689if (arguments.length === 1) {2690while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;2691while (++i < n) if ((b = array[i]) != null) {2692if (a > b) a = b;2693if (c < b) c = b;2694}2695} else {2696while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;2697while (++i < n) if ((b = f.call(array, array[i], i)) != null) {2698if (a > b) a = b;2699if (c < b) c = b;2700}2701}2702return [ a, c ];2703};2704d3.random = {2705normal: function(µ, σ) {2706var n = arguments.length;2707if (n < 2) σ = 1;2708if (n < 1) µ = 0;2709return function() {2710var x, y, r;2711do {2712x = Math.random() * 2 - 1;2713y = Math.random() * 2 - 1;2714r = x * x + y * y;2715} while (!r || r > 1);2716return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);2717};2718},2719logNormal: function(µ, σ) {2720var n = arguments.length;2721if (n < 2) σ = 1;2722if (n < 1) µ = 0;2723var random = d3.random.normal();2724return function() {2725return Math.exp(µ + σ * random());2726};2727},2728irwinHall: function(m) {2729return function() {2730for (var s = 0, j = 0; j < m; j++) s += Math.random();2731return s / m;2732};2733}2734};2735d3.sum = function(array, f) {2736var s = 0, n = array.length, a, i = -1;2737if (arguments.length === 1) {2738while (++i < n) if (!isNaN(a = +array[i])) s += a;2739} else {2740while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;2741}2742return s;2743};2744d3.quantile = function(values, p) {2745var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h;2746return e ? v + e * (values[h] - v) : v;2747};2748d3.transpose = function(matrix) {2749return d3.zip.apply(d3, matrix);2750};2751d3.zip = function() {2752if (!(n = arguments.length)) return [];2753for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {2754for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {2755zip[j] = arguments[j][i];2756}2757}2758return zips;2759};2760d3.bisector = function(f) {2761return {2762left: function(a, x, lo, hi) {2763if (arguments.length < 3) lo = 0;2764if (arguments.length < 4) hi = a.length;2765while (lo < hi) {2766var mid = lo + hi >>> 1;2767if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;2768}2769return lo;2770},2771right: function(a, x, lo, hi) {2772if (arguments.length < 3) lo = 0;2773if (arguments.length < 4) hi = a.length;2774while (lo < hi) {2775var mid = lo + hi >>> 1;2776if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;2777}2778return lo;2779}2780};2781};2782var d3_bisector = d3.bisector(function(d) {2783return d;2784});2785d3.bisectLeft = d3_bisector.left;2786d3.bisect = d3.bisectRight = d3_bisector.right;2787d3.first = function(array, f) {2788var i = 0, n = array.length, a = array[0], b;2789if (arguments.length === 1) f = d3.ascending;2790while (++i < n) {2791if (f.call(array, a, b = array[i]) > 0) {2792a = b;2793}2794}2795return a;2796};2797d3.last = function(array, f) {2798var i = 0, n = array.length, a = array[0], b;2799if (arguments.length === 1) f = d3.ascending;2800while (++i < n) {2801if (f.call(array, a, b = array[i]) <= 0) {2802a = b;2803}2804}2805return a;2806};2807d3.nest = function() {2808function map(array, depth) {2809if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;2810var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};2811while (++i < n) {2812if (values = valuesByKey.get(keyValue = key(object = array[i]))) {2813values.push(object);2814} else {2815valuesByKey.set(keyValue, [ object ]);2816}2817}2818valuesByKey.forEach(function(keyValue, values) {2819o[keyValue] = map(values, depth);2820});2821return o;2822}2823function entries(map, depth) {2824if (depth >= keys.length) return map;2825var a = [], sortKey = sortKeys[depth++], key;2826for (key in map) {2827a.push({2828key: key,2829values: entries(map[key], depth)2830});2831}2832if (sortKey) a.sort(function(a, b) {2833return sortKey(a.key, b.key);2834});2835return a;2836}2837var nest = {}, keys = [], sortKeys = [], sortValues, rollup;2838nest.map = function(array) {2839return map(array, 0);2840};2841nest.entries = function(array) {2842return entries(map(array, 0), 0);2843};2844nest.key = function(d) {2845keys.push(d);2846return nest;2847};2848nest.sortKeys = function(order) {2849sortKeys[keys.length - 1] = order;2850return nest;2851};2852nest.sortValues = function(order) {2853sortValues = order;2854return nest;2855};2856nest.rollup = function(f) {2857rollup = f;2858return nest;2859};2860return nest;2861};2862d3.keys = function(map) {2863var keys = [];2864for (var key in map) keys.push(key);2865return keys;2866};2867d3.values = function(map) {2868var values = [];2869for (var key in map) values.push(map[key]);2870return values;2871};2872d3.entries = function(map) {2873var entries = [];2874for (var key in map) entries.push({2875key: key,2876value: map[key]2877});2878return entries;2879};2880d3.permute = function(array, indexes) {2881var permutes = [], i = -1, n = indexes.length;2882while (++i < n) permutes[i] = array[indexes[i]];2883return permutes;2884};2885d3.merge = function(arrays) {2886return Array.prototype.concat.apply([], arrays);2887};2888d3.split = function(array, f) {2889var arrays = [], values = [], value, i = -1, n = array.length;2890if (arguments.length < 2) f = d3_splitter;2891while (++i < n) {2892if (f.call(values, value = array[i], i)) {2893values = [];2894} else {2895if (!values.length) arrays.push(values);2896values.push(value);2897}2898}2899return arrays;2900};2901d3.range = function(start, stop, step) {2902if (arguments.length < 3) {2903step = 1;2904if (arguments.length < 2) {2905stop = start;2906start = 0;2907}2908}2909if ((stop - start) / step === Infinity) throw new Error("infinite range");2910var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;2911start *= k, stop *= k, step *= k;2912if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);2913return range;2914};2915d3.requote = function(s) {2916return s.replace(d3_requote_re, "\\$&");2917};2918var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;2919d3.round = function(x, n) {2920return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);2921};2922d3.xhr = function(url, mime, callback) {2923var req = new XMLHttpRequest;2924if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime);2925req.open("GET", url, true);2926if (mime) req.setRequestHeader("Accept", mime);2927req.onreadystatechange = function() {2928if (req.readyState === 4) {2929var s = req.status;2930callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);2931}2932};2933req.send(null);2934};2935d3.text = function(url, mime, callback) {2936function ready(req) {2937callback(req && req.responseText);2938}2939if (arguments.length < 3) {2940callback = mime;2941mime = null;2942}2943d3.xhr(url, mime, ready);2944};2945d3.json = function(url, callback) {2946d3.text(url, "application/json", function(text) {2947callback(text ? JSON.parse(text) : null);2948});2949};2950d3.html = function(url, callback) {2951d3.text(url, "text/html", function(text) {2952if (text != null) {2953var range = document.createRange();2954range.selectNode(document.body);2955text = range.createContextualFragment(text);2956}2957callback(text);2958});2959};2960d3.xml = function(url, mime, callback) {2961function ready(req) {2962callback(req && req.responseXML);2963}2964if (arguments.length < 3) {2965callback = mime;2966mime = null;2967}2968d3.xhr(url, mime, ready);2969};2970var d3_nsPrefix = {2971svg: "http://www.w3.org/2000/svg",2972xhtml: "http://www.w3.org/1999/xhtml",2973xlink: "http://www.w3.org/1999/xlink",2974xml: "http://www.w3.org/XML/1998/namespace",2975xmlns: "http://www.w3.org/2000/xmlns/"2976};2977d3.ns = {2978prefix: d3_nsPrefix,2979qualify: function(name) {2980var i = name.indexOf(":"), prefix = name;2981if (i >= 0) {2982prefix = name.substring(0, i);2983name = name.substring(i + 1);2984}2985return d3_nsPrefix.hasOwnProperty(prefix) ? {2986space: d3_nsPrefix[prefix],2987local: name2988} : name;2989}2990};2991d3.dispatch = function() {2992var dispatch = new d3_dispatch, i = -1, n = arguments.length;2993while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);2994return dispatch;2995};2996d3_dispatch.prototype.on = function(type, listener) {2997var i = type.indexOf("."), name = "";2998if (i > 0) {2999name = type.substring(i + 1);3000type = type.substring(0, i);3001}3002return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);3003};3004d3.format = function(specifier) {3005var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;3006if (precision) precision = +precision.substring(1);3007if (zfill) {3008fill = "0";3009if (comma) width -= Math.floor((width - 1) / 4);3010}3011switch (type) {3012case "n":3013comma = true;3014type = "g";3015break;3016case "%":3017scale = 100;3018suffix = "%";3019type = "f";3020break;3021case "p":3022scale = 100;3023suffix = "%";3024type = "r";3025break;3026case "d":3027integer = true;3028precision = 0;3029break;3030case "s":3031scale = -1;3032type = "r";3033break;3034}3035if (type == "r" && !precision) type = "g";3036type = d3_format_types.get(type) || d3_format_typeDefault;3037return function(value) {3038if (integer && value % 1) return "";3039var negative = value < 0 && (value = -value) ? "-" : sign;3040if (scale < 0) {3041var prefix = d3.formatPrefix(value, precision);3042value = prefix.scale(value);3043suffix = prefix.symbol;3044} else {3045value *= scale;3046}3047value = type(value, precision);3048if (zfill) {3049var length = value.length + negative.length;3050if (length < width) value = (new Array(width - length + 1)).join(fill) + value;3051if (comma) value = d3_format_group(value);3052value = negative + value;3053} else {3054if (comma) value = d3_format_group(value);3055value = negative + value;3056var length = value.length;3057if (length < width) value = (new Array(width - length + 1)).join(fill) + value;3058}3059return value + suffix;3060};3061};3062var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;3063var d3_format_types = d3.map({3064g: function(x, p) {3065return x.toPrecision(p);3066},3067e: function(x, p) {3068return x.toExponential(p);3069},3070f: function(x, p) {3071return x.toFixed(p);3072},3073r: function(x, p) {3074return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p)));3075}3076});3077var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);3078d3.formatPrefix = function(value, precision) {3079var i = 0;3080if (value) {3081if (value < 0) value *= -1;3082if (precision) value = d3.round(value, d3_format_precision(value, precision));3083i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);3084i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));3085}3086return d3_formatPrefixes[8 + i / 3];3087};3088var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() {3089return d3_ease_identity;3090};3091var d3_ease = d3.map({3092linear: d3_ease_default,3093poly: d3_ease_poly,3094quad: function() {3095return d3_ease_quad;3096},3097cubic: function() {3098return d3_ease_cubic;3099},3100sin: function() {3101return d3_ease_sin;3102},3103exp: function() {3104return d3_ease_exp;3105},3106circle: function() {3107return d3_ease_circle;3108},3109elastic: d3_ease_elastic,3110back: d3_ease_back,3111bounce: function() {3112return d3_ease_bounce;3113}3114});3115var d3_ease_mode = d3.map({3116"in": d3_ease_identity,3117out: d3_ease_reverse,3118"in-out": d3_ease_reflect,3119"out-in": function(f) {3120return d3_ease_reflect(d3_ease_reverse(f));3121}3122});3123d3.ease = function(name) {3124var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";3125t = d3_ease.get(t) || d3_ease_default;3126m = d3_ease_mode.get(m) || d3_ease_identity;3127return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));3128};3129d3.event = null;3130d3.transform = function(string) {3131var g = document.createElementNS(d3.ns.prefix.svg, "g");3132return (d3.transform = function(string) {3133g.setAttribute("transform", string);3134var t = g.transform.baseVal.consolidate();3135return new d3_transform(t ? t.matrix : d3_transformIdentity);3136})(string);3137};3138d3_transform.prototype.toString = function() {3139return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";3140};3141var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = {3142a: 1,3143b: 0,3144c: 0,3145d: 1,3146e: 0,3147f: 03148};3149d3.interpolate = function(a, b) {3150var i = d3.interpolators.length, f;3151while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;3152return f;3153};3154d3.interpolateNumber = function(a, b) {3155b -= a;3156return function(t) {3157return a + b * t;3158};3159};3160d3.interpolateRound = function(a, b) {3161b -= a;3162return function(t) {3163return Math.round(a + b * t);3164};3165};3166d3.interpolateString = function(a, b) {3167var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;3168d3_interpolate_number.lastIndex = 0;3169for (i = 0; m = d3_interpolate_number.exec(b); ++i) {3170if (m.index) s.push(b.substring(s0, s1 = m.index));3171q.push({3172i: s.length,3173x: m[0]3174});3175s.push(null);3176s0 = d3_interpolate_number.lastIndex;3177}3178if (s0 < b.length) s.push(b.substring(s0));3179for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {3180o = q[i];3181if (o.x == m[0]) {3182if (o.i) {3183if (s[o.i + 1] == null) {3184s[o.i - 1] += o.x;3185s.splice(o.i, 1);3186for (j = i + 1; j < n; ++j) q[j].i--;3187} else {3188s[o.i - 1] += o.x + s[o.i + 1];3189s.splice(o.i, 2);3190for (j = i + 1; j < n; ++j) q[j].i -= 2;3191}3192} else {3193if (s[o.i + 1] == null) {3194s[o.i] = o.x;3195} else {3196s[o.i] = o.x + s[o.i + 1];3197s.splice(o.i + 1, 1);3198for (j = i + 1; j < n; ++j) q[j].i--;3199}3200}3201q.splice(i, 1);3202n--;3203i--;3204} else {3205o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));3206}3207}3208while (i < n) {3209o = q.pop();3210if (s[o.i + 1] == null) {3211s[o.i] = o.x;3212} else {3213s[o.i] = o.x + s[o.i + 1];3214s.splice(o.i + 1, 1);3215}3216n--;3217}3218if (s.length === 1) {3219return s[0] == null ? q[0].x : function() {3220return b;3221};3222}3223return function(t) {3224for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);3225return s.join("");3226};3227};3228d3.interpolateTransform = function(a, b) {3229var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;3230if (ta[0] != tb[0] || ta[1] != tb[1]) {3231s.push("translate(", null, ",", null, ")");3232q.push({3233i: 1,3234x: d3.interpolateNumber(ta[0], tb[0])3235}, {3236i: 3,3237x: d3.interpolateNumber(ta[1], tb[1])3238});3239} else if (tb[0] || tb[1]) {3240s.push("translate(" + tb + ")");3241} else {3242s.push("");3243}3244if (ra != rb) {3245if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;3246q.push({3247i: s.push(s.pop() + "rotate(", null, ")") - 2,3248x: d3.interpolateNumber(ra, rb)3249});3250} else if (rb) {3251s.push(s.pop() + "rotate(" + rb + ")");3252}3253if (wa != wb) {3254q.push({3255i: s.push(s.pop() + "skewX(", null, ")") - 2,3256x: d3.interpolateNumber(wa, wb)3257});3258} else if (wb) {3259s.push(s.pop() + "skewX(" + wb + ")");3260}3261if (ka[0] != kb[0] || ka[1] != kb[1]) {3262n = s.push(s.pop() + "scale(", null, ",", null, ")");3263q.push({3264i: n - 4,3265x: d3.interpolateNumber(ka[0], kb[0])3266}, {3267i: n - 2,3268x: d3.interpolateNumber(ka[1], kb[1])3269});3270} else if (kb[0] != 1 || kb[1] != 1) {3271s.push(s.pop() + "scale(" + kb + ")");3272}3273n = q.length;3274return function(t) {3275var i = -1, o;3276while (++i < n) s[(o = q[i]).i] = o.x(t);3277return s.join("");3278};3279};3280d3.interpolateRgb = function(a, b) {3281a = d3.rgb(a);3282b = d3.rgb(b);3283var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;3284return function(t) {3285return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));3286};3287};3288d3.interpolateHsl = function(a, b) {3289a = d3.hsl(a);3290b = d3.hsl(b);3291var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;3292if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;3293return function(t) {3294return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";3295};3296};3297d3.interpolateLab = function(a, b) {3298a = d3.lab(a);3299b = d3.lab(b);3300var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;3301return function(t) {3302return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";3303};3304};3305d3.interpolateHcl = function(a, b) {3306a = d3.hcl(a);3307b = d3.hcl(b);3308var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;3309if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;3310return function(t) {3311return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";3312};3313};3314d3.interpolateArray = function(a, b) {3315var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;3316for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));3317for (; i < na; ++i) c[i] = a[i];3318for (; i < nb; ++i) c[i] = b[i];3319return function(t) {3320for (i = 0; i < n0; ++i) c[i] = x[i](t);3321return c;3322};3323};3324d3.interpolateObject = function(a, b) {3325var i = {}, c = {}, k;3326for (k in a) {3327if (k in b) {3328i[k] = d3_interpolateByName(k)(a[k], b[k]);3329} else {3330c[k] = a[k];3331}3332}3333for (k in b) {3334if (!(k in a)) {3335c[k] = b[k];3336}3337}3338return function(t) {3339for (k in i) c[k] = i[k](t);3340return c;3341};3342};3343var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;3344d3.interpolators = [ d3.interpolateObject, function(a, b) {3345return b instanceof Array && d3.interpolateArray(a, b);3346}, function(a, b) {3347return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");3348}, function(a, b) {3349return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b);3350}, function(a, b) {3351return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);3352} ];3353d3.rgb = function(r, g, b) {3354return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);3355};3356d3_Rgb.prototype.brighter = function(k) {3357k = Math.pow(.7, arguments.length ? k : 1);3358var r = this.r, g = this.g, b = this.b, i = 30;3359if (!r && !g && !b) return d3_rgb(i, i, i);3360if (r && r < i) r = i;3361if (g && g < i) g = i;3362if (b && b < i) b = i;3363return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));3364};3365d3_Rgb.prototype.darker = function(k) {3366k = Math.pow(.7, arguments.length ? k : 1);3367return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));3368};3369d3_Rgb.prototype.hsl = function() {3370return d3_rgb_hsl(this.r, this.g, this.b);3371};3372d3_Rgb.prototype.toString = function() {3373return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);3374};3375var d3_rgb_names = d3.map({3376aliceblue: "#f0f8ff",3377antiquewhite: "#faebd7",3378aqua: "#00ffff",3379aquamarine: "#7fffd4",3380azure: "#f0ffff",3381beige: "#f5f5dc",3382bisque: "#ffe4c4",3383black: "#000000",3384blanchedalmond: "#ffebcd",3385blue: "#0000ff",3386blueviolet: "#8a2be2",3387brown: "#a52a2a",3388burlywood: "#deb887",3389cadetblue: "#5f9ea0",3390chartreuse: "#7fff00",3391chocolate: "#d2691e",3392coral: "#ff7f50",3393cornflowerblue: "#6495ed",3394cornsilk: "#fff8dc",3395crimson: "#dc143c",3396cyan: "#00ffff",3397darkblue: "#00008b",3398darkcyan: "#008b8b",3399darkgoldenrod: "#b8860b",3400darkgray: "#a9a9a9",3401darkgreen: "#006400",3402darkgrey: "#a9a9a9",3403darkkhaki: "#bdb76b",3404darkmagenta: "#8b008b",3405darkolivegreen: "#556b2f",3406darkorange: "#ff8c00",3407darkorchid: "#9932cc",3408darkred: "#8b0000",3409darksalmon: "#e9967a",3410darkseagreen: "#8fbc8f",3411darkslateblue: "#483d8b",3412darkslategray: "#2f4f4f",3413darkslategrey: "#2f4f4f",3414darkturquoise: "#00ced1",3415darkviolet: "#9400d3",3416deeppink: "#ff1493",3417deepskyblue: "#00bfff",3418dimgray: "#696969",3419dimgrey: "#696969",3420dodgerblue: "#1e90ff",3421firebrick: "#b22222",3422floralwhite: "#fffaf0",3423forestgreen: "#228b22",3424fuchsia: "#ff00ff",3425gainsboro: "#dcdcdc",3426ghostwhite: "#f8f8ff",3427gold: "#ffd700",3428goldenrod: "#daa520",3429gray: "#808080",3430green: "#008000",3431greenyellow: "#adff2f",3432grey: "#808080",3433honeydew: "#f0fff0",3434hotpink: "#ff69b4",3435indianred: "#cd5c5c",3436indigo: "#4b0082",3437ivory: "#fffff0",3438khaki: "#f0e68c",3439lavender: "#e6e6fa",3440lavenderblush: "#fff0f5",3441lawngreen: "#7cfc00",3442lemonchiffon: "#fffacd",3443lightblue: "#add8e6",3444lightcoral: "#f08080",3445lightcyan: "#e0ffff",3446lightgoldenrodyellow: "#fafad2",3447lightgray: "#d3d3d3",3448lightgreen: "#90ee90",3449lightgrey: "#d3d3d3",3450lightpink: "#ffb6c1",3451lightsalmon: "#ffa07a",3452lightseagreen: "#20b2aa",3453lightskyblue: "#87cefa",3454lightslategray: "#778899",3455lightslategrey: "#778899",3456lightsteelblue: "#b0c4de",3457lightyellow: "#ffffe0",3458lime: "#00ff00",3459limegreen: "#32cd32",3460linen: "#faf0e6",3461magenta: "#ff00ff",3462maroon: "#800000",3463mediumaquamarine: "#66cdaa",3464mediumblue: "#0000cd",3465mediumorchid: "#ba55d3",3466mediumpurple: "#9370db",3467mediumseagreen: "#3cb371",3468mediumslateblue: "#7b68ee",3469mediumspringgreen: "#00fa9a",3470mediumturquoise: "#48d1cc",3471mediumvioletred: "#c71585",3472midnightblue: "#191970",3473mintcream: "#f5fffa",3474mistyrose: "#ffe4e1",3475moccasin: "#ffe4b5",3476navajowhite: "#ffdead",3477navy: "#000080",3478oldlace: "#fdf5e6",3479olive: "#808000",3480olivedrab: "#6b8e23",3481orange: "#ffa500",3482orangered: "#ff4500",3483orchid: "#da70d6",3484palegoldenrod: "#eee8aa",3485palegreen: "#98fb98",3486paleturquoise: "#afeeee",3487palevioletred: "#db7093",3488papayawhip: "#ffefd5",3489peachpuff: "#ffdab9",3490peru: "#cd853f",3491pink: "#ffc0cb",3492plum: "#dda0dd",3493powderblue: "#b0e0e6",3494purple: "#800080",3495red: "#ff0000",3496rosybrown: "#bc8f8f",3497royalblue: "#4169e1",3498saddlebrown: "#8b4513",3499salmon: "#fa8072",3500sandybrown: "#f4a460",3501seagreen: "#2e8b57",3502seashell: "#fff5ee",3503sienna: "#a0522d",3504silver: "#c0c0c0",3505skyblue: "#87ceeb",3506slateblue: "#6a5acd",3507slategray: "#708090",3508slategrey: "#708090",3509snow: "#fffafa",3510springgreen: "#00ff7f",3511steelblue: "#4682b4",3512tan: "#d2b48c",3513teal: "#008080",3514thistle: "#d8bfd8",3515tomato: "#ff6347",3516turquoise: "#40e0d0",3517violet: "#ee82ee",3518wheat: "#f5deb3",3519white: "#ffffff",3520whitesmoke: "#f5f5f5",3521yellow: "#ffff00",3522yellowgreen: "#9acd32"3523});3524d3_rgb_names.forEach(function(key, value) {3525d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));3526});3527d3.hsl = function(h, s, l) {3528return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);3529};3530d3_Hsl.prototype.brighter = function(k) {3531k = Math.pow(.7, arguments.length ? k : 1);3532return d3_hsl(this.h, this.s, this.l / k);3533};3534d3_Hsl.prototype.darker = function(k) {3535k = Math.pow(.7, arguments.length ? k : 1);3536return d3_hsl(this.h, this.s, k * this.l);3537};3538d3_Hsl.prototype.rgb = function() {3539return d3_hsl_rgb(this.h, this.s, this.l);3540};3541d3_Hsl.prototype.toString = function() {3542return this.rgb().toString();3543};3544d3.hcl = function(h, c, l) {3545return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);3546};3547d3_Hcl.prototype.brighter = function(k) {3548return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));3549};3550d3_Hcl.prototype.darker = function(k) {3551return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));3552};3553d3_Hcl.prototype.rgb = function() {3554return d3_hcl_lab(this.h, this.c, this.l).rgb();3555};3556d3_Hcl.prototype.toString = function() {3557return this.rgb() + "";3558};3559d3.lab = function(l, a, b) {3560return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);3561};3562var d3_lab_K = 18;3563var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;3564d3_Lab.prototype.brighter = function(k) {3565return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);3566};3567d3_Lab.prototype.darker = function(k) {3568return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);3569};3570d3_Lab.prototype.rgb = function() {3571return d3_lab_rgb(this.l, this.a, this.b);3572};3573d3_Lab.prototype.toString = function() {3574return this.rgb() + "";3575};3576var d3_select = function(s, n) {3577return n.querySelector(s);3578}, d3_selectAll = function(s, n) {3579return n.querySelectorAll(s);3580}, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {3581return d3_selectMatcher.call(n, s);3582};3583if (typeof Sizzle === "function") {3584d3_select = function(s, n) {3585return Sizzle(s, n)[0] || null;3586};3587d3_selectAll = function(s, n) {3588return Sizzle.uniqueSort(Sizzle(s, n));3589};3590d3_selectMatches = Sizzle.matchesSelector;3591}3592var d3_selectionPrototype = [];3593d3.selection = function() {3594return d3_selectionRoot;3595};3596d3.selection.prototype = d3_selectionPrototype;3597d3_selectionPrototype.select = function(selector) {3598var subgroups = [], subgroup, subnode, group, node;3599if (typeof selector !== "function") selector = d3_selection_selector(selector);3600for (var j = -1, m = this.length; ++j < m; ) {3601subgroups.push(subgroup = []);3602subgroup.parentNode = (group = this[j]).parentNode;3603for (var i = -1, n = group.length; ++i < n; ) {3604if (node = group[i]) {3605subgroup.push(subnode = selector.call(node, node.__data__, i));3606if (subnode && "__data__" in node) subnode.__data__ = node.__data__;3607} else {3608subgroup.push(null);3609}3610}3611}3612return d3_selection(subgroups);3613};3614d3_selectionPrototype.selectAll = function(selector) {3615var subgroups = [], subgroup, node;3616if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);3617for (var j = -1, m = this.length; ++j < m; ) {3618for (var group = this[j], i = -1, n = group.length; ++i < n; ) {3619if (node = group[i]) {3620subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));3621subgroup.parentNode = node;3622}3623}3624}3625return d3_selection(subgroups);3626};3627d3_selectionPrototype.attr = function(name, value) {3628if (arguments.length < 2) {3629if (typeof name === "string") {3630var node = this.node();3631name = d3.ns.qualify(name);3632return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);3633}3634for (value in name) this.each(d3_selection_attr(value, name[value]));3635return this;3636}3637return this.each(d3_selection_attr(name, value));3638};3639d3_selectionPrototype.classed = function(name, value) {3640if (arguments.length < 2) {3641if (typeof name === "string") {3642var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;3643if (value = node.classList) {3644while (++i < n) if (!value.contains(name[i])) return false;3645} else {3646value = node.className;3647if (value.baseVal != null) value = value.baseVal;3648while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;3649}3650return true;3651}3652for (value in name) this.each(d3_selection_classed(value, name[value]));3653return this;3654}3655return this.each(d3_selection_classed(name, value));3656};3657d3_selectionPrototype.style = function(name, value, priority) {3658var n = arguments.length;3659if (n < 3) {3660if (typeof name !== "string") {3661if (n < 2) value = "";3662for (priority in name) this.each(d3_selection_style(priority, name[priority], value));3663return this;3664}3665if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name);3666priority = "";3667}3668return this.each(d3_selection_style(name, value, priority));3669};3670d3_selectionPrototype.property = function(name, value) {3671if (arguments.length < 2) {3672if (typeof name === "string") return this.node()[name];3673for (value in name) this.each(d3_selection_property(value, name[value]));3674return this;3675}3676return this.each(d3_selection_property(name, value));3677};3678d3_selectionPrototype.text = function(value) {3679return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {3680var v = value.apply(this, arguments);3681this.textContent = v == null ? "" : v;3682} : value == null ? function() {3683this.textContent = "";3684} : function() {3685this.textContent = value;3686});3687};3688d3_selectionPrototype.html = function(value) {3689return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {3690var v = value.apply(this, arguments);3691this.innerHTML = v == null ? "" : v;3692} : value == null ? function() {3693this.innerHTML = "";3694} : function() {3695this.innerHTML = value;3696});3697};3698d3_selectionPrototype.append = function(name) {3699function append() {3700return this.appendChild(document.createElementNS(this.namespaceURI, name));3701}3702function appendNS() {3703return this.appendChild(document.createElementNS(name.space, name.local));3704}3705name = d3.ns.qualify(name);3706return this.select(name.local ? appendNS : append);3707};3708d3_selectionPrototype.insert = function(name, before) {3709function insert() {3710return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this));3711}3712function insertNS() {3713return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this));3714}3715name = d3.ns.qualify(name);3716return this.select(name.local ? insertNS : insert);3717};3718d3_selectionPrototype.remove = function() {3719return this.each(function() {3720var parent = this.parentNode;3721if (parent) parent.removeChild(this);3722});3723};3724d3_selectionPrototype.data = function(value, key) {3725function bind(group, groupData) {3726var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;3727if (key) {3728var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;3729for (i = -1; ++i < n; ) {3730keyValue = key.call(node = group[i], node.__data__, i);3731if (nodeByKeyValue.has(keyValue)) {3732exitNodes[j++] = node;3733} else {3734nodeByKeyValue.set(keyValue, node);3735}3736keyValues.push(keyValue);3737}3738for (i = -1; ++i < m; ) {3739keyValue = key.call(groupData, nodeData = groupData[i], i);3740if (nodeByKeyValue.has(keyValue)) {3741updateNodes[i] = node = nodeByKeyValue.get(keyValue);3742node.__data__ = nodeData;3743enterNodes[i] = exitNodes[i] = null;3744} else {3745enterNodes[i] = d3_selection_dataNode(nodeData);3746updateNodes[i] = exitNodes[i] = null;3747}3748nodeByKeyValue.remove(keyValue);3749}3750for (i = -1; ++i < n; ) {3751if (nodeByKeyValue.has(keyValues[i])) {3752exitNodes[i] = group[i];3753}3754}3755} else {3756for (i = -1; ++i < n0; ) {3757node = group[i];3758nodeData = groupData[i];3759if (node) {3760node.__data__ = nodeData;3761updateNodes[i] = node;3762enterNodes[i] = exitNodes[i] = null;3763} else {3764enterNodes[i] = d3_selection_dataNode(nodeData);3765updateNodes[i] = exitNodes[i] = null;3766}3767}3768for (; i < m; ++i) {3769enterNodes[i] = d3_selection_dataNode(groupData[i]);3770updateNodes[i] = exitNodes[i] = null;3771}3772for (; i < n1; ++i) {3773exitNodes[i] = group[i];3774enterNodes[i] = updateNodes[i] = null;3775}3776}3777enterNodes.update = updateNodes;3778enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;3779enter.push(enterNodes);3780update.push(updateNodes);3781exit.push(exitNodes);3782}3783var i = -1, n = this.length, group, node;3784if (!arguments.length) {3785value = new Array(n = (group = this[0]).length);3786while (++i < n) {3787if (node = group[i]) {3788value[i] = node.__data__;3789}3790}3791return value;3792}3793var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);3794if (typeof value === "function") {3795while (++i < n) {3796bind(group = this[i], value.call(group, group.parentNode.__data__, i));3797}3798} else {3799while (++i < n) {3800bind(group = this[i], value);3801}3802}3803update.enter = function() {3804return enter;3805};3806update.exit = function() {3807return exit;3808};3809return update;3810};3811d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) {3812return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);3813};3814d3_selectionPrototype.filter = function(filter) {3815var subgroups = [], subgroup, group, node;3816if (typeof filter !== "function") filter = d3_selection_filter(filter);3817for (var j = 0, m = this.length; j < m; j++) {3818subgroups.push(subgroup = []);3819subgroup.parentNode = (group = this[j]).parentNode;3820for (var i = 0, n = group.length; i < n; i++) {3821if ((node = group[i]) && filter.call(node, node.__data__, i)) {3822subgroup.push(node);3823}3824}3825}3826return d3_selection(subgroups);3827};3828d3_selectionPrototype.order = function() {3829for (var j = -1, m = this.length; ++j < m; ) {3830for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {3831if (node = group[i]) {3832if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);3833next = node;3834}3835}3836}3837return this;3838};3839d3_selectionPrototype.sort = function(comparator) {3840comparator = d3_selection_sortComparator.apply(this, arguments);3841for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);3842return this.order();3843};3844d3_selectionPrototype.on = function(type, listener, capture) {3845var n = arguments.length;3846if (n < 3) {3847if (typeof type !== "string") {3848if (n < 2) listener = false;3849for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));3850return this;3851}3852if (n < 2) return (n = this.node()["__on" + type]) && n._;3853capture = false;3854}3855return this.each(d3_selection_on(type, listener, capture));3856};3857d3_selectionPrototype.each = function(callback) {3858return d3_selection_each(this, function(node, i, j) {3859callback.call(node, node.__data__, i, j);3860});3861};3862d3_selectionPrototype.call = function(callback) {3863callback.apply(this, (arguments[0] = this, arguments));3864return this;3865};3866d3_selectionPrototype.empty = function() {3867return !this.node();3868};3869d3_selectionPrototype.node = function(callback) {3870for (var j = 0, m = this.length; j < m; j++) {3871for (var group = this[j], i = 0, n = group.length; i < n; i++) {3872var node = group[i];3873if (node) return node;3874}3875}3876return null;3877};3878d3_selectionPrototype.transition = function() {3879var subgroups = [], subgroup, node;3880for (var j = -1, m = this.length; ++j < m; ) {3881subgroups.push(subgroup = []);3882for (var group = this[j], i = -1, n = group.length; ++i < n; ) {3883subgroup.push((node = group[i]) ? {3884node: node,3885delay: d3_transitionDelay,3886duration: d3_transitionDuration3887} : null);3888}3889}3890return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());3891};3892var d3_selectionRoot = d3_selection([ [ document ] ]);3893d3_selectionRoot[0].parentNode = d3_selectRoot;3894d3.select = function(selector) {3895return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);3896};3897d3.selectAll = function(selector) {3898return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);3899};3900var d3_selection_enterPrototype = [];3901d3.selection.enter = d3_selection_enter;3902d3.selection.enter.prototype = d3_selection_enterPrototype;3903d3_selection_enterPrototype.append = d3_selectionPrototype.append;3904d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;3905d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;3906d3_selection_enterPrototype.node = d3_selectionPrototype.node;3907d3_selection_enterPrototype.select = function(selector) {3908var subgroups = [], subgroup, subnode, upgroup, group, node;3909for (var j = -1, m = this.length; ++j < m; ) {3910upgroup = (group = this[j]).update;3911subgroups.push(subgroup = []);3912subgroup.parentNode = group.parentNode;3913for (var i = -1, n = group.length; ++i < n; ) {3914if (node = group[i]) {3915subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));3916subnode.__data__ = node.__data__;3917} else {3918subgroup.push(null);3919}3920}3921}3922return d3_selection(subgroups);3923};3924var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase;3925d3_transitionPrototype.call = d3_selectionPrototype.call;3926d3.transition = function(selection) {3927return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition();3928};3929d3.transition.prototype = d3_transitionPrototype;3930d3_transitionPrototype.select = function(selector) {3931var subgroups = [], subgroup, subnode, node;3932if (typeof selector !== "function") selector = d3_selection_selector(selector);3933for (var j = -1, m = this.length; ++j < m; ) {3934subgroups.push(subgroup = []);3935for (var group = this[j], i = -1, n = group.length; ++i < n; ) {3936if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {3937if ("__data__" in node.node) subnode.__data__ = node.node.__data__;3938subgroup.push({3939node: subnode,3940delay: node.delay,3941duration: node.duration3942});3943} else {3944subgroup.push(null);3945}3946}3947}3948return d3_transition(subgroups, this.id, this.time).ease(this.ease());3949};3950d3_transitionPrototype.selectAll = function(selector) {3951var subgroups = [], subgroup, subnodes, node;3952if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);3953for (var j = -1, m = this.length; ++j < m; ) {3954for (var group = this[j], i = -1, n = group.length; ++i < n; ) {3955if (node = group[i]) {3956subnodes = selector.call(node.node, node.node.__data__, i);3957subgroups.push(subgroup = []);3958for (var k = -1, o = subnodes.length; ++k < o; ) {3959subgroup.push({3960node: subnodes[k],3961delay: node.delay,3962duration: node.duration3963});3964}3965}3966}3967}3968return d3_transition(subgroups, this.id, this.time).ease(this.ease());3969};3970d3_transitionPrototype.filter = function(filter) {3971var subgroups = [], subgroup, group, node;3972if (typeof filter !== "function") filter = d3_selection_filter(filter);3973for (var j = 0, m = this.length; j < m; j++) {3974subgroups.push(subgroup = []);3975for (var group = this[j], i = 0, n = group.length; i < n; i++) {3976if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) {3977subgroup.push(node);3978}3979}3980}3981return d3_transition(subgroups, this.id, this.time).ease(this.ease());3982};3983d3_transitionPrototype.attr = function(name, value) {3984if (arguments.length < 2) {3985for (value in name) this.attrTween(value, d3_tweenByName(name[value], value));3986return this;3987}3988return this.attrTween(name, d3_tweenByName(value, name));3989};3990d3_transitionPrototype.attrTween = function(nameNS, tween) {3991function attrTween(d, i) {3992var f = tween.call(this, d, i, this.getAttribute(name));3993return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) {3994this.setAttribute(name, f(t));3995};3996}3997function attrTweenNS(d, i) {3998var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));3999return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) {4000this.setAttributeNS(name.space, name.local, f(t));4001};4002}4003var name = d3.ns.qualify(nameNS);4004return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);4005};4006d3_transitionPrototype.style = function(name, value, priority) {4007var n = arguments.length;4008if (n < 3) {4009if (typeof name !== "string") {4010if (n < 2) value = "";4011for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value);4012return this;4013}4014priority = "";4015}4016return this.styleTween(name, d3_tweenByName(value, name), priority);4017};4018d3_transitionPrototype.styleTween = function(name, tween, priority) {4019if (arguments.length < 3) priority = "";4020return this.tween("style." + name, function(d, i) {4021var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));4022return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) {4023this.style.setProperty(name, f(t), priority);4024};4025});4026};4027d3_transitionPrototype.text = function(value) {4028return this.tween("text", function(d, i) {4029this.textContent = typeof value === "function" ? value.call(this, d, i) : value;4030});4031};4032d3_transitionPrototype.remove = function() {4033return this.each("end.transition", function() {4034var p;4035if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);4036});4037};4038d3_transitionPrototype.delay = function(value) {4039return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {4040node.delay = value.call(node = node.node, node.__data__, i, j) | 0;4041} : (value = value | 0, function(node) {4042node.delay = value;4043}));4044};4045d3_transitionPrototype.duration = function(value) {4046return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {4047node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0);4048} : (value = Math.max(1, value | 0), function(node) {4049node.duration = value;4050}));4051};4052d3_transitionPrototype.transition = function() {4053return this.select(d3_this);4054};4055d3.tween = function(b, interpolate) {4056function tweenFunction(d, i, a) {4057var v = b.call(this, d, i);4058return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v);4059}4060function tweenString(d, i, a) {4061return a != b && interpolate(a, b);4062}4063return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString);4064};4065var d3_tweenRemove = {};4066var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;4067d3.timer = function(callback, delay, then) {4068var found = false, t0, t1 = d3_timer_queue;4069if (arguments.length < 3) {4070if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;4071then = Date.now();4072}4073while (t1) {4074if (t1.callback === callback) {4075t1.then = then;4076t1.delay = delay;4077found = true;4078break;4079}4080t0 = t1;4081t1 = t1.next;4082}4083if (!found) d3_timer_queue = {4084callback: callback,4085then: then,4086delay: delay,4087next: d3_timer_queue4088};4089if (!d3_timer_interval) {4090d3_timer_timeout = clearTimeout(d3_timer_timeout);4091d3_timer_interval = 1;4092d3_timer_frame(d3_timer_step);4093}4094};4095d3.timer.flush = function() {4096var elapsed, now = Date.now(), t1 = d3_timer_queue;4097while (t1) {4098elapsed = now - t1.then;4099if (!t1.delay) t1.flush = t1.callback(elapsed);4100t1 = t1.next;4101}4102d3_timer_flush();4103};4104var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {4105setTimeout(callback, 17);4106};4107d3.mouse = function(container) {4108return d3_mousePoint(container, d3_eventSource());4109};4110var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;4111d3.touches = function(container, touches) {4112if (arguments.length < 2) touches = d3_eventSource().touches;4113return touches ? d3_array(touches).map(function(touch) {4114var point = d3_mousePoint(container, touch);4115point.identifier = touch.identifier;4116return point;4117}) : [];4118};4119d3.scale = {};4120d3.scale.linear = function() {4121return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);4122};4123d3.scale.log = function() {4124return d3_scale_log(d3.scale.linear(), d3_scale_logp);4125};4126var d3_scale_logFormat = d3.format(".0e");4127d3_scale_logp.pow = function(x) {4128return Math.pow(10, x);4129};4130d3_scale_logn.pow = function(x) {4131return -Math.pow(10, -x);4132};4133d3.scale.pow = function() {4134return d3_scale_pow(d3.scale.linear(), 1);4135};4136d3.scale.sqrt = function() {4137return d3.scale.pow().exponent(.5);4138};4139d3.scale.ordinal = function() {4140return d3_scale_ordinal([], {4141t: "range",4142a: [ [] ]4143});4144};4145d3.scale.category10 = function() {4146return d3.scale.ordinal().range(d3_category10);4147};4148d3.scale.category20 = function() {4149return d3.scale.ordinal().range(d3_category20);4150};4151d3.scale.category20b = function() {4152return d3.scale.ordinal().range(d3_category20b);4153};4154d3.scale.category20c = function() {4155return d3.scale.ordinal().range(d3_category20c);4156};4157var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];4158var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];4159var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];4160var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];4161d3.scale.quantile = function() {4162return d3_scale_quantile([], []);4163};4164d3.scale.quantize = function() {4165return d3_scale_quantize(0, 1, [ 0, 1 ]);4166};4167d3.scale.threshold = function() {4168return d3_scale_threshold([ .5 ], [ 0, 1 ]);4169};4170d3.scale.identity = function() {4171return d3_scale_identity([ 0, 1 ]);4172};4173d3.svg = {};4174d3.svg.arc = function() {4175function arc() {4176var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);4177return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";4178}4179var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;4180arc.innerRadius = function(v) {4181if (!arguments.length) return innerRadius;4182innerRadius = d3_functor(v);4183return arc;4184};4185arc.outerRadius = function(v) {4186if (!arguments.length) return outerRadius;4187outerRadius = d3_functor(v);4188return arc;4189};4190arc.startAngle = function(v) {4191if (!arguments.length) return startAngle;4192startAngle = d3_functor(v);4193return arc;4194};4195arc.endAngle = function(v) {4196if (!arguments.length) return endAngle;4197endAngle = d3_functor(v);4198return arc;4199};4200arc.centroid = function() {4201var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;4202return [ Math.cos(a) * r, Math.sin(a) * r ];4203};4204return arc;4205};4206var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;4207d3.svg.line = function() {4208return d3_svg_line(d3_identity);4209};4210var d3_svg_lineInterpolators = d3.map({4211linear: d3_svg_lineLinear,4212"linear-closed": d3_svg_lineLinearClosed,4213"step-before": d3_svg_lineStepBefore,4214"step-after": d3_svg_lineStepAfter,4215basis: d3_svg_lineBasis,4216"basis-open": d3_svg_lineBasisOpen,4217"basis-closed": d3_svg_lineBasisClosed,4218bundle: d3_svg_lineBundle,4219cardinal: d3_svg_lineCardinal,4220"cardinal-open": d3_svg_lineCardinalOpen,4221"cardinal-closed": d3_svg_lineCardinalClosed,4222monotone: d3_svg_lineMonotone4223});4224d3_svg_lineInterpolators.forEach(function(key, value) {4225value.key = key;4226value.closed = /-closed$/.test(key);4227});4228var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];4229d3.svg.line.radial = function() {4230var line = d3_svg_line(d3_svg_lineRadial);4231line.radius = line.x, delete line.x;4232line.angle = line.y, delete line.y;4233return line;4234};4235d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;4236d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;4237d3.svg.area = function() {4238return d3_svg_area(d3_identity);4239};4240d3.svg.area.radial = function() {4241var area = d3_svg_area(d3_svg_lineRadial);4242area.radius = area.x, delete area.x;4243area.innerRadius = area.x0, delete area.x0;4244area.outerRadius = area.x1, delete area.x1;4245area.angle = area.y, delete area.y;4246area.startAngle = area.y0, delete area.y0;4247area.endAngle = area.y1, delete area.y1;4248return area;4249};4250d3.svg.chord = function() {4251function chord(d, i) {4252var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);4253return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";4254}4255function subgroup(self, f, d, i) {4256var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;4257return {4258r: r,4259a0: a0,4260a1: a1,4261p0: [ r * Math.cos(a0), r * Math.sin(a0) ],4262p1: [ r * Math.cos(a1), r * Math.sin(a1) ]4263};4264}4265function equals(a, b) {4266return a.a0 == b.a0 && a.a1 == b.a1;4267}4268function arc(r, p, a) {4269return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;4270}4271function curve(r0, p0, r1, p1) {4272return "Q 0,0 " + p1;4273}4274var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;4275chord.radius = function(v) {4276if (!arguments.length) return radius;4277radius = d3_functor(v);4278return chord;4279};4280chord.source = function(v) {4281if (!arguments.length) return source;4282source = d3_functor(v);4283return chord;4284};4285chord.target = function(v) {4286if (!arguments.length) return target;4287target = d3_functor(v);4288return chord;4289};4290chord.startAngle = function(v) {4291if (!arguments.length) return startAngle;4292startAngle = d3_functor(v);4293return chord;4294};4295chord.endAngle = function(v) {4296if (!arguments.length) return endAngle;4297endAngle = d3_functor(v);4298return chord;4299};4300return chord;4301};4302d3.svg.diagonal = function() {4303function diagonal(d, i) {4304var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {4305x: p0.x,4306y: m4307}, {4308x: p3.x,4309y: m4310}, p3 ];4311p = p.map(projection);4312return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];4313}4314var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;4315diagonal.source = function(x) {4316if (!arguments.length) return source;4317source = d3_functor(x);4318return diagonal;4319};4320diagonal.target = function(x) {4321if (!arguments.length) return target;4322target = d3_functor(x);4323return diagonal;4324};4325diagonal.projection = function(x) {4326if (!arguments.length) return projection;4327projection = x;4328return diagonal;4329};4330return diagonal;4331};4332d3.svg.diagonal.radial = function() {4333var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;4334diagonal.projection = function(x) {4335return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;4336};4337return diagonal;4338};4339d3.svg.mouse = d3.mouse;4340d3.svg.touches = d3.touches;4341d3.svg.symbol = function() {4342function symbol(d, i) {4343return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));4344}4345var type = d3_svg_symbolType, size = d3_svg_symbolSize;4346symbol.type = function(x) {4347if (!arguments.length) return type;4348type = d3_functor(x);4349return symbol;4350};4351symbol.size = function(x) {4352if (!arguments.length) return size;4353size = d3_functor(x);4354return symbol;4355};4356return symbol;4357};4358var d3_svg_symbols = d3.map({4359circle: d3_svg_symbolCircle,4360cross: function(size) {4361var r = Math.sqrt(size / 5) / 2;4362return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";4363},4364diamond: function(size) {4365var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;4366return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";4367},4368square: function(size) {4369var r = Math.sqrt(size) / 2;4370return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";4371},4372"triangle-down": function(size) {4373var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;4374return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";4375},4376"triangle-up": function(size) {4377var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;4378return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";4379}4380});4381d3.svg.symbolTypes = d3_svg_symbols.keys();4382var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);4383d3.svg.axis = function() {4384function axis(g) {4385g.each(function() {4386var g = d3.select(this);4387var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;4388var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);4389var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;4390var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);4391var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;4392this.__chart__ = scale1;4393tickEnter.append("line").attr("class", "tick");4394tickEnter.append("text");4395var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");4396switch (orient) {4397case "bottom":4398{4399tickTransform = d3_svg_axisX;4400subtickEnter.attr("y2", tickMinorSize);4401subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);4402lineEnter.attr("y2", tickMajorSize);4403textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);4404lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);4405textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);4406text.attr("dy", ".71em").attr("text-anchor", "middle");4407pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);4408break;4409}4410case "top":4411{4412tickTransform = d3_svg_axisX;4413subtickEnter.attr("y2", -tickMinorSize);4414subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);4415lineEnter.attr("y2", -tickMajorSize);4416textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));4417lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);4418textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));4419text.attr("dy", "0em").attr("text-anchor", "middle");4420pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);4421break;4422}4423case "left":4424{4425tickTransform = d3_svg_axisY;4426subtickEnter.attr("x2", -tickMinorSize);4427subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);4428lineEnter.attr("x2", -tickMajorSize);4429textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));4430lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);4431textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);4432text.attr("dy", ".32em").attr("text-anchor", "end");4433pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);4434break;4435}4436case "right":4437{4438tickTransform = d3_svg_axisY;4439subtickEnter.attr("x2", tickMinorSize);4440subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);4441lineEnter.attr("x2", tickMajorSize);4442textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);4443lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);4444textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);4445text.attr("dy", ".32em").attr("text-anchor", "start");4446pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);4447break;4448}4449}4450if (scale.ticks) {4451tickEnter.call(tickTransform, scale0);4452tickUpdate.call(tickTransform, scale1);4453tickExit.call(tickTransform, scale1);4454subtickEnter.call(tickTransform, scale0);4455subtickUpdate.call(tickTransform, scale1);4456subtickExit.call(tickTransform, scale1);4457} else {4458var dx = scale1.rangeBand() / 2, x = function(d) {4459return scale1(d) + dx;4460};4461tickEnter.call(tickTransform, x);4462tickUpdate.call(tickTransform, x);4463}4464});4465}4466var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;4467axis.scale = function(x) {4468if (!arguments.length) return scale;4469scale = x;4470return axis;4471};4472axis.orient = function(x) {4473if (!arguments.length) return orient;4474orient = x;4475return axis;4476};4477axis.ticks = function() {4478if (!arguments.length) return tickArguments_;4479tickArguments_ = arguments;4480return axis;4481};4482axis.tickValues = function(x) {4483if (!arguments.length) return tickValues;4484tickValues = x;4485return axis;4486};4487axis.tickFormat = function(x) {4488if (!arguments.length) return tickFormat_;4489tickFormat_ = x;4490return axis;4491};4492axis.tickSize = function(x, y, z) {4493if (!arguments.length) return tickMajorSize;4494var n = arguments.length - 1;4495tickMajorSize = +x;4496tickMinorSize = n > 1 ? +y : tickMajorSize;4497tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;4498return axis;4499};4500axis.tickPadding = function(x) {4501if (!arguments.length) return tickPadding;4502tickPadding = +x;4503return axis;4504};4505axis.tickSubdivide = function(x) {4506if (!arguments.length) return tickSubdivide;4507tickSubdivide = +x;4508return axis;4509};4510return axis;4511};4512d3.svg.brush = function() {4513function brush(g) {4514g.each(function() {4515var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;4516g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);4517bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");4518fg.enter().append("rect").attr("class", "extent").style("cursor", "move");4519tz.enter().append("g").attr("class", function(d) {4520return "resize " + d;4521}).style("cursor", function(d) {4522return d3_svg_brushCursor[d];4523}).append("rect").attr("x", function(d) {4524return /[ew]$/.test(d) ? -3 : null;4525}).attr("y", function(d) {4526return /^[ns]/.test(d) ? -3 : null;4527}).attr("width", 6).attr("height", 6).style("visibility", "hidden");4528tz.style("display", brush.empty() ? "none" : null);4529tz.exit().remove();4530if (x) {4531e = d3_scaleRange(x);4532bg.attr("x", e[0]).attr("width", e[1] - e[0]);4533redrawX(g);4534}4535if (y) {4536e = d3_scaleRange(y);4537bg.attr("y", e[0]).attr("height", e[1] - e[0]);4538redrawY(g);4539}4540redraw(g);4541});4542}4543function redraw(g) {4544g.selectAll(".resize").attr("transform", function(d) {4545return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";4546});4547}4548function redrawX(g) {4549g.select(".extent").attr("x", extent[0][0]);4550g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);4551}4552function redrawY(g) {4553g.select(".extent").attr("y", extent[0][1]);4554g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);4555}4556function brushstart() {4557function mouse() {4558var touches = d3.event.changedTouches;4559return touches ? d3.touches(target, touches)[0] : d3.mouse(target);4560}4561function keydown() {4562if (d3.event.keyCode == 32) {4563if (!dragging) {4564center = null;4565origin[0] -= extent[1][0];4566origin[1] -= extent[1][1];4567dragging = 2;4568}4569d3_eventCancel();4570}4571}4572function keyup() {4573if (d3.event.keyCode == 32 && dragging == 2) {4574origin[0] += extent[1][0];4575origin[1] += extent[1][1];4576dragging = 0;4577d3_eventCancel();4578}4579}4580function brushmove() {4581var point = mouse(), moved = false;4582if (offset) {4583point[0] += offset[0];4584point[1] += offset[1];4585}4586if (!dragging) {4587if (d3.event.altKey) {4588if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];4589origin[0] = extent[+(point[0] < center[0])][0];4590origin[1] = extent[+(point[1] < center[1])][1];4591} else center = null;4592}4593if (resizingX && move1(point, x, 0)) {4594redrawX(g);4595moved = true;4596}4597if (resizingY && move1(point, y, 1)) {4598redrawY(g);4599moved = true;4600}4601if (moved) {4602redraw(g);4603event_({4604type: "brush",4605mode: dragging ? "move" : "resize"4606});4607}4608}4609function move1(point, scale, i) {4610var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;4611if (dragging) {4612r0 -= position;4613r1 -= size + position;4614}4615min = Math.max(r0, Math.min(r1, point[i]));4616if (dragging) {4617max = (min += position) + size;4618} else {4619if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));4620if (position < min) {4621max = min;4622min = position;4623} else {4624max = position;4625}4626}4627if (extent[0][i] !== min || extent[1][i] !== max) {4628extentDomain = null;4629extent[0][i] = min;4630extent[1][i] = max;4631return true;4632}4633}4634function brushend() {4635brushmove();4636g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);4637d3.select("body").style("cursor", null);4638w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);4639event_({4640type: "brushend"4641});4642d3_eventCancel();4643}4644var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;4645var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);4646if (dragging) {4647origin[0] = extent[0][0] - origin[0];4648origin[1] = extent[0][1] - origin[1];4649} else if (resizing) {4650var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);4651offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];4652origin[0] = extent[ex][0];4653origin[1] = extent[ey][1];4654} else if (d3.event.altKey) center = origin.slice();4655g.style("pointer-events", "none").selectAll(".resize").style("display", null);4656d3.select("body").style("cursor", eventTarget.style("cursor"));4657event_({4658type: "brushstart"4659});4660brushmove();4661d3_eventCancel();4662}4663var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;4664brush.x = function(z) {4665if (!arguments.length) return x;4666x = z;4667resizes = d3_svg_brushResizes[!x << 1 | !y];4668return brush;4669};4670brush.y = function(z) {4671if (!arguments.length) return y;4672y = z;4673resizes = d3_svg_brushResizes[!x << 1 | !y];4674return brush;4675};4676brush.extent = function(z) {4677var x0, x1, y0, y1, t;4678if (!arguments.length) {4679z = extentDomain || extent;4680if (x) {4681x0 = z[0][0], x1 = z[1][0];4682if (!extentDomain) {4683x0 = extent[0][0], x1 = extent[1][0];4684if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);4685if (x1 < x0) t = x0, x0 = x1, x1 = t;4686}4687}4688if (y) {4689y0 = z[0][1], y1 = z[1][1];4690if (!extentDomain) {4691y0 = extent[0][1], y1 = extent[1][1];4692if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);4693if (y1 < y0) t = y0, y0 = y1, y1 = t;4694}4695}4696return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];4697}4698extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];4699if (x) {4700x0 = z[0], x1 = z[1];4701if (y) x0 = x0[0], x1 = x1[0];4702extentDomain[0][0] = x0, extentDomain[1][0] = x1;4703if (x.invert) x0 = x(x0), x1 = x(x1);4704if (x1 < x0) t = x0, x0 = x1, x1 = t;4705extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;4706}4707if (y) {4708y0 = z[0], y1 = z[1];4709if (x) y0 = y0[1], y1 = y1[1];4710extentDomain[0][1] = y0, extentDomain[1][1] = y1;4711if (y.invert) y0 = y(y0), y1 = y(y1);4712if (y1 < y0) t = y0, y0 = y1, y1 = t;4713extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;4714}4715return brush;4716};4717brush.clear = function() {4718extentDomain = null;4719extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;4720return brush;4721};4722brush.empty = function() {4723return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];4724};4725return d3.rebind(brush, event, "on");4726};4727var d3_svg_brushCursor = {4728n: "ns-resize",4729e: "ew-resize",4730s: "ns-resize",4731w: "ew-resize",4732nw: "nwse-resize",4733ne: "nesw-resize",4734se: "nwse-resize",4735sw: "nesw-resize"4736};4737var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];4738d3.behavior = {};4739d3.behavior.drag = function() {4740function drag() {4741this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);4742}4743function mousedown() {4744function point() {4745var p = target.parentNode;4746return touchId ? d3.touches(p).filter(function(p) {4747return p.identifier === touchId;4748})[0] : d3.mouse(p);4749}4750function dragmove() {4751if (!target.parentNode) return dragend();4752var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];4753moved |= dx | dy;4754origin_ = p;4755d3_eventCancel();4756event_({4757type: "drag",4758x: p[0] + offset[0],4759y: p[1] + offset[1],4760dx: dx,4761dy: dy4762});4763}4764function dragend() {4765event_({4766type: "dragend"4767});4768if (moved) {4769d3_eventCancel();4770if (d3.event.target === eventTarget) w.on("click.drag", click, true);4771}4772w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);4773}4774function click() {4775d3_eventCancel();4776w.on("click.drag", null);4777}4778var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0;4779var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);4780if (origin) {4781offset = origin.apply(target, arguments);4782offset = [ offset.x - origin_[0], offset.y - origin_[1] ];4783} else {4784offset = [ 0, 0 ];4785}4786if (!touchId) d3_eventCancel();4787event_({4788type: "dragstart"4789});4790}4791var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;4792drag.origin = function(x) {4793if (!arguments.length) return origin;4794origin = x;4795return drag;4796};4797return d3.rebind(drag, event, "on");4798};4799d3.behavior.zoom = function() {4800function zoom() {4801this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);4802}4803function location(p) {4804return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];4805}4806function point(l) {4807return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];4808}4809function scaleTo(s) {4810scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));4811}4812function translateTo(p, l) {4813l = point(l);4814translate[0] += p[0] - l[0];4815translate[1] += p[1] - l[1];4816}4817function dispatch(event) {4818if (x1) x1.domain(x0.range().map(function(x) {4819return (x - translate[0]) / scale;4820}).map(x0.invert));4821if (y1) y1.domain(y0.range().map(function(y) {4822return (y - translate[1]) / scale;4823}).map(y0.invert));4824d3.event.preventDefault();4825event({4826type: "zoom",4827scale: scale,4828translate: translate4829});4830}4831function mousedown() {4832function mousemove() {4833moved = 1;4834translateTo(d3.mouse(target), l);4835dispatch(event_);4836}4837function mouseup() {4838if (moved) d3_eventCancel();4839w.on("mousemove.zoom", null).on("mouseup.zoom", null);4840if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);4841}4842function click() {4843d3_eventCancel();4844w.on("click.zoom", null);4845}4846var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));4847window.focus();4848d3_eventCancel();4849}4850function mousewheel() {4851if (!translate0) translate0 = location(d3.mouse(this));4852scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);4853translateTo(d3.mouse(this), translate0);4854dispatch(event.of(this, arguments));4855}4856function mousemove() {4857translate0 = null;4858}4859function dblclick() {4860var p = d3.mouse(this), l = location(p);4861scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);4862translateTo(p, l);4863dispatch(event.of(this, arguments));4864}4865function touchstart() {4866var touches = d3.touches(this), now = Date.now();4867scale0 = scale;4868translate0 = {};4869touches.forEach(function(t) {4870translate0[t.identifier] = location(t);4871});4872d3_eventCancel();4873if (touches.length === 1) {4874if (now - touchtime < 500) {4875var p = touches[0], l = location(touches[0]);4876scaleTo(scale * 2);4877translateTo(p, l);4878dispatch(event.of(this, arguments));4879}4880touchtime = now;4881}4882}4883function touchmove() {4884var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];4885if (p1 = touches[1]) {4886var p1, l1 = translate0[p1.identifier];4887p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];4888l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];4889scaleTo(d3.event.scale * scale0);4890}4891translateTo(p0, l0);4892touchtime = null;4893dispatch(event.of(this, arguments));4894}4895var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;4896zoom.translate = function(x) {4897if (!arguments.length) return translate;4898translate = x.map(Number);4899return zoom;4900};4901zoom.scale = function(x) {4902if (!arguments.length) return scale;4903scale = +x;4904return zoom;4905};4906zoom.scaleExtent = function(x) {4907if (!arguments.length) return scaleExtent;4908scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);4909return zoom;4910};4911zoom.x = function(z) {4912if (!arguments.length) return x1;4913x1 = z;4914x0 = z.copy();4915return zoom;4916};4917zoom.y = function(z) {4918if (!arguments.length) return y1;4919y1 = z;4920y0 = z.copy();4921return zoom;4922};4923return d3.rebind(zoom, event, "on");4924};4925var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];4926d3.layout = {};4927d3.layout.bundle = function() {4928return function(links) {4929var paths = [], i = -1, n = links.length;4930while (++i < n) paths.push(d3_layout_bundlePath(links[i]));4931return paths;4932};4933};4934d3.layout.chord = function() {4935function relayout() {4936var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;4937chords = [];4938groups = [];4939k = 0, i = -1;4940while (++i < n) {4941x = 0, j = -1;4942while (++j < n) {4943x += matrix[i][j];4944}4945groupSums.push(x);4946subgroupIndex.push(d3.range(n));4947k += x;4948}4949if (sortGroups) {4950groupIndex.sort(function(a, b) {4951return sortGroups(groupSums[a], groupSums[b]);4952});4953}4954if (sortSubgroups) {4955subgroupIndex.forEach(function(d, i) {4956d.sort(function(a, b) {4957return sortSubgroups(matrix[i][a], matrix[i][b]);4958});4959});4960}4961k = (2 * Math.PI - padding * n) / k;4962x = 0, i = -1;4963while (++i < n) {4964x0 = x, j = -1;4965while (++j < n) {4966var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;4967subgroups[di + "-" + dj] = {4968index: di,4969subindex: dj,4970startAngle: a0,4971endAngle: a1,4972value: v4973};4974}4975groups[di] = {4976index: di,4977startAngle: x0,4978endAngle: x,4979value: (x - x0) / k4980};4981x += padding;4982}4983i = -1;4984while (++i < n) {4985j = i - 1;4986while (++j < n) {4987var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];4988if (source.value || target.value) {4989chords.push(source.value < target.value ? {4990source: target,4991target: source4992} : {4993source: source,4994target: target4995});4996}4997}4998}4999if (sortChords) resort();5000}5001function resort() {5002chords.sort(function(a, b) {5003return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);5004});5005}5006var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;5007chord.matrix = function(x) {5008if (!arguments.length) return matrix;5009n = (matrix = x) && matrix.length;5010chords = groups = null;5011return chord;5012};5013chord.padding = function(x) {5014if (!arguments.length) return padding;5015padding = x;5016chords = groups = null;5017return chord;5018};5019chord.sortGroups = function(x) {5020if (!arguments.length) return sortGroups;5021sortGroups = x;5022chords = groups = null;5023return chord;5024};5025chord.sortSubgroups = function(x) {5026if (!arguments.length) return sortSubgroups;5027sortSubgroups = x;5028chords = null;5029return chord;5030};5031chord.sortChords = function(x) {5032if (!arguments.length) return sortChords;5033sortChords = x;5034if (chords) resort();5035return chord;5036};5037chord.chords = function() {5038if (!chords) relayout();5039return chords;5040};5041chord.groups = function() {5042if (!groups) relayout();5043return groups;5044};5045return chord;5046};5047d3.layout.force = function() {5048function repulse(node) {5049return function(quad, x1, y1, x2, y2) {5050if (quad.point !== node) {5051var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);5052if ((x2 - x1) * dn < theta) {5053var k = quad.charge * dn * dn;5054node.px -= dx * k;5055node.py -= dy * k;5056return true;5057}5058if (quad.point && isFinite(dn)) {5059var k = quad.pointCharge * dn * dn;5060node.px -= dx * k;5061node.py -= dy * k;5062}5063}5064return !quad.charge;5065};5066}5067function dragmove(d) {5068d.px = d3.event.x;5069d.py = d3.event.y;5070force.resume();5071}5072var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges;5073force.tick = function() {5074if ((alpha *= .99) < .005) {5075event.end({5076type: "end",5077alpha: alpha = 05078});5079return true;5080}5081var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;5082for (i = 0; i < m; ++i) {5083o = links[i];5084s = o.source;5085t = o.target;5086x = t.x - s.x;5087y = t.y - s.y;5088if (l = x * x + y * y) {5089l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;5090x *= l;5091y *= l;5092t.x -= x * (k = s.weight / (t.weight + s.weight));5093t.y -= y * k;5094s.x += x * (k = 1 - k);5095s.y += y * k;5096}5097}5098if (k = alpha * gravity) {5099x = size[0] / 2;5100y = size[1] / 2;5101i = -1;5102if (k) while (++i < n) {5103o = nodes[i];5104o.x += (x - o.x) * k;5105o.y += (y - o.y) * k;5106}5107}5108if (charge) {5109d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);5110i = -1;5111while (++i < n) {5112if (!(o = nodes[i]).fixed) {5113q.visit(repulse(o));5114}5115}5116}5117i = -1;5118while (++i < n) {5119o = nodes[i];5120if (o.fixed) {5121o.x = o.px;5122o.y = o.py;5123} else {5124o.x -= (o.px - (o.px = o.x)) * friction;5125o.y -= (o.py - (o.py = o.y)) * friction;5126}5127}5128event.tick({5129type: "tick",5130alpha: alpha5131});5132};5133force.nodes = function(x) {5134if (!arguments.length) return nodes;5135nodes = x;5136return force;5137};5138force.links = function(x) {5139if (!arguments.length) return links;5140links = x;5141return force;5142};5143force.size = function(x) {5144if (!arguments.length) return size;5145size = x;5146return force;5147};5148force.linkDistance = function(x) {5149if (!arguments.length) return linkDistance;5150linkDistance = d3_functor(x);5151return force;5152};5153force.distance = force.linkDistance;5154force.linkStrength = function(x) {5155if (!arguments.length) return linkStrength;5156linkStrength = d3_functor(x);5157return force;5158};5159force.friction = function(x) {5160if (!arguments.length) return friction;5161friction = x;5162return force;5163};5164force.charge = function(x) {5165if (!arguments.length) return charge;5166charge = typeof x === "function" ? x : +x;5167return force;5168};5169force.gravity = function(x) {5170if (!arguments.length) return gravity;5171gravity = x;5172return force;5173};5174force.theta = function(x) {5175if (!arguments.length) return theta;5176theta = x;5177return force;5178};5179force.alpha = function(x) {5180if (!arguments.length) return alpha;5181if (alpha) {5182if (x > 0) alpha = x; else alpha = 0;5183} else if (x > 0) {5184event.start({5185type: "start",5186alpha: alpha = x5187});5188d3.timer(force.tick);5189}5190return force;5191};5192force.start = function() {5193function position(dimension, size) {5194var neighbors = neighbor(i), j = -1, m = neighbors.length, x;5195while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;5196return Math.random() * size;5197}5198function neighbor() {5199if (!neighbors) {5200neighbors = [];5201for (j = 0; j < n; ++j) {5202neighbors[j] = [];5203}5204for (j = 0; j < m; ++j) {5205var o = links[j];5206neighbors[o.source.index].push(o.target);5207neighbors[o.target.index].push(o.source);5208}5209}5210return neighbors[i];5211}5212var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;5213for (i = 0; i < n; ++i) {5214(o = nodes[i]).index = i;5215o.weight = 0;5216}5217distances = [];5218strengths = [];5219for (i = 0; i < m; ++i) {5220o = links[i];5221if (typeof o.source == "number") o.source = nodes[o.source];5222if (typeof o.target == "number") o.target = nodes[o.target];5223distances[i] = linkDistance.call(this, o, i);5224strengths[i] = linkStrength.call(this, o, i);5225++o.source.weight;5226++o.target.weight;5227}5228for (i = 0; i < n; ++i) {5229o = nodes[i];5230if (isNaN(o.x)) o.x = position("x", w);5231if (isNaN(o.y)) o.y = position("y", h);5232if (isNaN(o.px)) o.px = o.x;5233if (isNaN(o.py)) o.py = o.y;5234}5235charges = [];5236if (typeof charge === "function") {5237for (i = 0; i < n; ++i) {5238charges[i] = +charge.call(this, nodes[i], i);5239}5240} else {5241for (i = 0; i < n; ++i) {5242charges[i] = charge;5243}5244}5245return force.resume();5246};5247force.resume = function() {5248return force.alpha(.1);5249};5250force.stop = function() {5251return force.alpha(0);5252};5253force.drag = function() {5254if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);5255this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);5256};5257return d3.rebind(force, event, "on");5258};5259d3.layout.partition = function() {5260function position(node, x, dx, dy) {5261var children = node.children;5262node.x = x;5263node.y = node.depth * dy;5264node.dx = dx;5265node.dy = dy;5266if (children && (n = children.length)) {5267var i = -1, n, c, d;5268dx = node.value ? dx / node.value : 0;5269while (++i < n) {5270position(c = children[i], x, d = c.value * dx, dy);5271x += d;5272}5273}5274}5275function depth(node) {5276var children = node.children, d = 0;5277if (children && (n = children.length)) {5278var i = -1, n;5279while (++i < n) d = Math.max(d, depth(children[i]));5280}5281return 1 + d;5282}5283function partition(d, i) {5284var nodes = hierarchy.call(this, d, i);5285position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));5286return nodes;5287}5288var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];5289partition.size = function(x) {5290if (!arguments.length) return size;5291size = x;5292return partition;5293};5294return d3_layout_hierarchyRebind(partition, hierarchy);5295};5296d3.layout.pie = function() {5297function pie(data, i) {5298var values = data.map(function(d, i) {5299return +value.call(pie, d, i);5300});5301var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);5302var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);5303var index = d3.range(data.length);5304if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {5305return values[j] - values[i];5306} : function(i, j) {5307return sort(data[i], data[j]);5308});5309var arcs = [];5310index.forEach(function(i) {5311var d;5312arcs[i] = {5313data: data[i],5314value: d = values[i],5315startAngle: a,5316endAngle: a += d * k5317};5318});5319return arcs;5320}5321var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;5322pie.value = function(x) {5323if (!arguments.length) return value;5324value = x;5325return pie;5326};5327pie.sort = function(x) {5328if (!arguments.length) return sort;5329sort = x;5330return pie;5331};5332pie.startAngle = function(x) {5333if (!arguments.length) return startAngle;5334startAngle = x;5335return pie;5336};5337pie.endAngle = function(x) {5338if (!arguments.length) return endAngle;5339endAngle = x;5340return pie;5341};5342return pie;5343};5344var d3_layout_pieSortByValue = {};5345d3.layout.stack = function() {5346function stack(data, index) {5347var series = data.map(function(d, i) {5348return values.call(stack, d, i);5349});5350var points = series.map(function(d, i) {5351return d.map(function(v, i) {5352return [ x.call(stack, v, i), y.call(stack, v, i) ];5353});5354});5355var orders = order.call(stack, points, index);5356series = d3.permute(series, orders);5357points = d3.permute(points, orders);5358var offsets = offset.call(stack, points, index);5359var n = series.length, m = series[0].length, i, j, o;5360for (j = 0; j < m; ++j) {5361out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);5362for (i = 1; i < n; ++i) {5363out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);5364}5365}5366return data;5367}5368var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;5369stack.values = function(x) {5370if (!arguments.length) return values;5371values = x;5372return stack;5373};5374stack.order = function(x) {5375if (!arguments.length) return order;5376order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;5377return stack;5378};5379stack.offset = function(x) {5380if (!arguments.length) return offset;5381offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;5382return stack;5383};5384stack.x = function(z) {5385if (!arguments.length) return x;5386x = z;5387return stack;5388};5389stack.y = function(z) {5390if (!arguments.length) return y;5391y = z;5392return stack;5393};5394stack.out = function(z) {5395if (!arguments.length) return out;5396out = z;5397return stack;5398};5399return stack;5400};5401var d3_layout_stackOrders = d3.map({5402"inside-out": function(data) {5403var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {5404return max[a] - max[b];5405}), top = 0, bottom = 0, tops = [], bottoms = [];5406for (i = 0; i < n; ++i) {5407j = index[i];5408if (top < bottom) {5409top += sums[j];5410tops.push(j);5411} else {5412bottom += sums[j];5413bottoms.push(j);5414}5415}5416return bottoms.reverse().concat(tops);5417},5418reverse: function(data) {5419return d3.range(data.length).reverse();5420},5421"default": d3_layout_stackOrderDefault5422});5423var d3_layout_stackOffsets = d3.map({5424silhouette: function(data) {5425var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];5426for (j = 0; j < m; ++j) {5427for (i = 0, o = 0; i < n; i++) o += data[i][j][1];5428if (o > max) max = o;5429sums.push(o);5430}5431for (j = 0; j < m; ++j) {5432y0[j] = (max - sums[j]) / 2;5433}5434return y0;5435},5436wiggle: function(data) {5437var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];5438y0[0] = o = o0 = 0;5439for (j = 1; j < m; ++j) {5440for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];5441for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {5442for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {5443s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;5444}5445s2 += s3 * data[i][j][1];5446}5447y0[j] = o -= s1 ? s2 / s1 * dx : 0;5448if (o < o0) o0 = o;5449}5450for (j = 0; j < m; ++j) y0[j] -= o0;5451return y0;5452},5453expand: function(data) {5454var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];5455for (j = 0; j < m; ++j) {5456for (i = 0, o = 0; i < n; i++) o += data[i][j][1];5457if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;5458}5459for (j = 0; j < m; ++j) y0[j] = 0;5460return y0;5461},5462zero: d3_layout_stackOffsetZero5463});5464d3.layout.histogram = function() {5465function histogram(data, i) {5466var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;5467while (++i < m) {5468bin = bins[i] = [];5469bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);5470bin.y = 0;5471}5472if (m > 0) {5473i = -1;5474while (++i < n) {5475x = values[i];5476if (x >= range[0] && x <= range[1]) {5477bin = bins[d3.bisect(thresholds, x, 1, m) - 1];5478bin.y += k;5479bin.push(data[i]);5480}5481}5482}5483return bins;5484}5485var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;5486histogram.value = function(x) {5487if (!arguments.length) return valuer;5488valuer = x;5489return histogram;5490};5491histogram.range = function(x) {5492if (!arguments.length) return ranger;5493ranger = d3_functor(x);5494return histogram;5495};5496histogram.bins = function(x) {5497if (!arguments.length) return binner;5498binner = typeof x === "number" ? function(range) {5499return d3_layout_histogramBinFixed(range, x);5500} : d3_functor(x);5501return histogram;5502};5503histogram.frequency = function(x) {5504if (!arguments.length) return frequency;5505frequency = !!x;5506return histogram;5507};5508return histogram;5509};5510d3.layout.hierarchy = function() {5511function recurse(data, depth, nodes) {5512var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {5513data: data5514};5515node.depth = depth;5516nodes.push(node);5517if (childs && (n = childs.length)) {5518var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;5519while (++i < n) {5520d = recurse(childs[i], j, nodes);5521d.parent = node;5522c.push(d);5523v += d.value;5524}5525if (sort) c.sort(sort);5526if (value) node.value = v;5527} else if (value) {5528node.value = +value.call(hierarchy, data, depth) || 0;5529}5530return node;5531}5532function revalue(node, depth) {5533var children = node.children, v = 0;5534if (children && (n = children.length)) {5535var i = -1, n, j = depth + 1;5536while (++i < n) v += revalue(children[i], j);5537} else if (value) {5538v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;5539}5540if (value) node.value = v;5541return v;5542}5543function hierarchy(d) {5544var nodes = [];5545recurse(d, 0, nodes);5546return nodes;5547}5548var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;5549hierarchy.sort = function(x) {5550if (!arguments.length) return sort;5551sort = x;5552return hierarchy;5553};5554hierarchy.children = function(x) {5555if (!arguments.length) return children;5556children = x;5557return hierarchy;5558};5559hierarchy.value = function(x) {5560if (!arguments.length) return value;5561value = x;5562return hierarchy;5563};5564hierarchy.revalue = function(root) {5565revalue(root, 0);5566return root;5567};5568return hierarchy;5569};5570var d3_layout_hierarchyInline = false;5571d3.layout.pack = function() {5572function pack(d, i) {5573var nodes = hierarchy.call(this, d, i), root = nodes[0];5574root.x = 0;5575root.y = 0;5576d3_layout_treeVisitAfter(root, function(d) {5577d.r = Math.sqrt(d.value);5578});5579d3_layout_treeVisitAfter(root, d3_layout_packSiblings);5580var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);5581if (padding > 0) {5582var dr = padding * k / 2;5583d3_layout_treeVisitAfter(root, function(d) {5584d.r += dr;5585});5586d3_layout_treeVisitAfter(root, d3_layout_packSiblings);5587d3_layout_treeVisitAfter(root, function(d) {5588d.r -= dr;5589});5590k = Math.max(2 * root.r / w, 2 * root.r / h);5591}5592d3_layout_packTransform(root, w / 2, h / 2, 1 / k);5593return nodes;5594}5595var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];5596pack.size = function(x) {5597if (!arguments.length) return size;5598size = x;5599return pack;5600};5601pack.padding = function(_) {5602if (!arguments.length) return padding;5603padding = +_;5604return pack;5605};5606return d3_layout_hierarchyRebind(pack, hierarchy);5607};5608d3.layout.cluster = function() {5609function cluster(d, i) {5610var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;5611d3_layout_treeVisitAfter(root, function(node) {5612var children = node.children;5613if (children && children.length) {5614node.x = d3_layout_clusterX(children);5615node.y = d3_layout_clusterY(children);5616} else {5617node.x = previousNode ? x += separation(node, previousNode) : 0;5618node.y = 0;5619previousNode = node;5620}5621});5622var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;5623d3_layout_treeVisitAfter(root, function(node) {5624node.x = (node.x - x0) / (x1 - x0) * size[0];5625node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];5626});5627return nodes;5628}5629var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];5630cluster.separation = function(x) {5631if (!arguments.length) return separation;5632separation = x;5633return cluster;5634};5635cluster.size = function(x) {5636if (!arguments.length) return size;5637size = x;5638return cluster;5639};5640return d3_layout_hierarchyRebind(cluster, hierarchy);5641};5642d3.layout.tree = function() {5643function tree(d, i) {5644function firstWalk(node, previousSibling) {5645var children = node.children, layout = node._tree;5646if (children && (n = children.length)) {5647var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;5648while (++i < n) {5649child = children[i];5650firstWalk(child, previousChild);5651ancestor = apportion(child, previousChild, ancestor);5652previousChild = child;5653}5654d3_layout_treeShift(node);5655var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);5656if (previousSibling) {5657layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);5658layout.mod = layout.prelim - midpoint;5659} else {5660layout.prelim = midpoint;5661}5662} else {5663if (previousSibling) {5664layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);5665}5666}5667}5668function secondWalk(node, x) {5669node.x = node._tree.prelim + x;5670var children = node.children;5671if (children && (n = children.length)) {5672var i = -1, n;5673x += node._tree.mod;5674while (++i < n) {5675secondWalk(children[i], x);5676}5677}5678}5679function apportion(node, previousSibling, ancestor) {5680if (previousSibling) {5681var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;5682while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {5683vom = d3_layout_treeLeft(vom);5684vop = d3_layout_treeRight(vop);5685vop._tree.ancestor = node;5686shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);5687if (shift > 0) {5688d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);5689sip += shift;5690sop += shift;5691}5692sim += vim._tree.mod;5693sip += vip._tree.mod;5694som += vom._tree.mod;5695sop += vop._tree.mod;5696}5697if (vim && !d3_layout_treeRight(vop)) {5698vop._tree.thread = vim;5699vop._tree.mod += sim - sop;5700}5701if (vip && !d3_layout_treeLeft(vom)) {5702vom._tree.thread = vip;5703vom._tree.mod += sip - som;5704ancestor = node;5705}5706}5707return ancestor;5708}5709var nodes = hierarchy.call(this, d, i), root = nodes[0];5710d3_layout_treeVisitAfter(root, function(node, previousSibling) {5711node._tree = {5712ancestor: node,5713prelim: 0,5714mod: 0,5715change: 0,5716shift: 0,5717number: previousSibling ? previousSibling._tree.number + 1 : 05718};5719});5720firstWalk(root);5721secondWalk(root, -root._tree.prelim);5722var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;5723d3_layout_treeVisitAfter(root, function(node) {5724node.x = (node.x - x0) / (x1 - x0) * size[0];5725node.y = node.depth / y1 * size[1];5726delete node._tree;5727});5728return nodes;5729}5730var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];5731tree.separation = function(x) {5732if (!arguments.length) return separation;5733separation = x;5734return tree;5735};5736tree.size = function(x) {5737if (!arguments.length) return size;5738size = x;5739return tree;5740};5741return d3_layout_hierarchyRebind(tree, hierarchy);5742};5743d3.layout.treemap = function() {5744function scale(children, k) {5745var i = -1, n = children.length, child, area;5746while (++i < n) {5747area = (child = children[i]).value * (k < 0 ? 0 : k);5748child.area = isNaN(area) || area <= 0 ? 0 : area;5749}5750}5751function squarify(node) {5752var children = node.children;5753if (children && children.length) {5754var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;5755scale(remaining, rect.dx * rect.dy / node.value);5756row.area = 0;5757while ((n = remaining.length) > 0) {5758row.push(child = remaining[n - 1]);5759row.area += child.area;5760if ((score = worst(row, u)) <= best) {5761remaining.pop();5762best = score;5763} else {5764row.area -= row.pop().area;5765position(row, u, rect, false);5766u = Math.min(rect.dx, rect.dy);5767row.length = row.area = 0;5768best = Infinity;5769}5770}5771if (row.length) {5772position(row, u, rect, true);5773row.length = row.area = 0;5774}5775children.forEach(squarify);5776}5777}5778function stickify(node) {5779var children = node.children;5780if (children && children.length) {5781var rect = pad(node), remaining = children.slice(), child, row = [];5782scale(remaining, rect.dx * rect.dy / node.value);5783row.area = 0;5784while (child = remaining.pop()) {5785row.push(child);5786row.area += child.area;5787if (child.z != null) {5788position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);5789row.length = row.area = 0;5790}5791}5792children.forEach(stickify);5793}5794}5795function worst(row, u) {5796var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;5797while (++i < n) {5798if (!(r = row[i].area)) continue;5799if (r < rmin) rmin = r;5800if (r > rmax) rmax = r;5801}5802s *= s;5803u *= u;5804return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;5805}5806function position(row, u, rect, flush) {5807var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;5808if (u == rect.dx) {5809if (flush || v > rect.dy) v = rect.dy;5810while (++i < n) {5811o = row[i];5812o.x = x;5813o.y = y;5814o.dy = v;5815x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);5816}5817o.z = true;5818o.dx += rect.x + rect.dx - x;5819rect.y += v;5820rect.dy -= v;5821} else {5822if (flush || v > rect.dx) v = rect.dx;5823while (++i < n) {5824o = row[i];5825o.x = x;5826o.y = y;5827o.dx = v;5828y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);5829}5830o.z = false;5831o.dy += rect.y + rect.dy - y;5832rect.x += v;5833rect.dx -= v;5834}5835}5836function treemap(d) {5837var nodes = stickies || hierarchy(d), root = nodes[0];5838root.x = 0;5839root.y = 0;5840root.dx = size[0];5841root.dy = size[1];5842if (stickies) hierarchy.revalue(root);5843scale([ root ], root.dx * root.dy / root.value);5844(stickies ? stickify : squarify)(root);5845if (sticky) stickies = nodes;5846return nodes;5847}5848var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5));5849treemap.size = function(x) {5850if (!arguments.length) return size;5851size = x;5852return treemap;5853};5854treemap.padding = function(x) {5855function padFunction(node) {5856var p = x.call(treemap, node, node.depth);5857return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);5858}5859function padConstant(node) {5860return d3_layout_treemapPad(node, x);5861}5862if (!arguments.length) return padding;5863var type;5864pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;5865return treemap;5866};5867treemap.round = function(x) {5868if (!arguments.length) return round != Number;5869round = x ? Math.round : Number;5870return treemap;5871};5872treemap.sticky = function(x) {5873if (!arguments.length) return sticky;5874sticky = x;5875stickies = null;5876return treemap;5877};5878treemap.ratio = function(x) {5879if (!arguments.length) return ratio;5880ratio = x;5881return treemap;5882};5883return d3_layout_hierarchyRebind(treemap, hierarchy);5884};5885d3.csv = d3_dsv(",", "text/csv");5886d3.tsv = d3_dsv(" ", "text/tab-separated-values");5887d3.geo = {};5888var d3_geo_radians = Math.PI / 180;5889d3.geo.azimuthal = function() {5890function azimuthal(coordinates) {5891var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1);5892return [ scale * x + translate[0], scale * y + translate[1] ];5893}5894var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;5895azimuthal.invert = function(coordinates) {5896var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c);5897return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ];5898};5899azimuthal.mode = function(x) {5900if (!arguments.length) return mode;5901mode = x + "";5902return azimuthal;5903};5904azimuthal.origin = function(x) {5905if (!arguments.length) return origin;5906origin = x;5907x0 = origin[0] * d3_geo_radians;5908y0 = origin[1] * d3_geo_radians;5909cy0 = Math.cos(y0);5910sy0 = Math.sin(y0);5911return azimuthal;5912};5913azimuthal.scale = function(x) {5914if (!arguments.length) return scale;5915scale = +x;5916return azimuthal;5917};5918azimuthal.translate = function(x) {5919if (!arguments.length) return translate;5920translate = [ +x[0], +x[1] ];5921return azimuthal;5922};5923return azimuthal.origin([ 0, 0 ]);5924};5925d3.geo.albers = function() {5926function albers(coordinates) {5927var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;5928return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];5929}5930function reload() {5931var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1);5932lng0 = d3_geo_radians * origin[0];5933n = .5 * (s + Math.sin(phi2));5934C = c * c + 2 * n * s;5935p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;5936return albers;5937}5938var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;5939albers.invert = function(coordinates) {5940var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y);5941return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];5942};5943albers.origin = function(x) {5944if (!arguments.length) return origin;5945origin = [ +x[0], +x[1] ];5946return reload();5947};5948albers.parallels = function(x) {5949if (!arguments.length) return parallels;5950parallels = [ +x[0], +x[1] ];5951return reload();5952};5953albers.scale = function(x) {5954if (!arguments.length) return scale;5955scale = +x;5956return albers;5957};5958albers.translate = function(x) {5959if (!arguments.length) return translate;5960translate = [ +x[0], +x[1] ];5961return albers;5962};5963return reload();5964};5965d3.geo.albersUsa = function() {5966function albersUsa(coordinates) {5967var lon = coordinates[0], lat = coordinates[1];5968return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);5969}5970var lower48 = d3.geo.albers();5971var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);5972var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);5973var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);5974albersUsa.scale = function(x) {5975if (!arguments.length) return lower48.scale();5976lower48.scale(x);5977alaska.scale(x * .6);5978hawaii.scale(x);5979puertoRico.scale(x * 1.5);5980return albersUsa.translate(lower48.translate());5981};5982albersUsa.translate = function(x) {5983if (!arguments.length) return lower48.translate();5984var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];5985lower48.translate(x);5986alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);5987hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);5988puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);5989return albersUsa;5990};5991return albersUsa.scale(lower48.scale());5992};5993d3.geo.bonne = function() {5994function bonne(coordinates) {5995var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;5996if (y1) {5997var p = c1 + y1 - y, E = x * Math.cos(y) / p;5998x = p * Math.sin(E);5999y = p * Math.cos(E) - c1;6000} else {6001x *= Math.cos(y);6002y *= -1;6003}6004return [ scale * x + translate[0], scale * y + translate[1] ];6005}6006var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;6007bonne.invert = function(coordinates) {6008var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;6009if (y1) {6010var c = c1 + y, p = Math.sqrt(x * x + c * c);6011y = c1 + y1 - p;6012x = x0 + p * Math.atan2(x, c) / Math.cos(y);6013} else {6014y *= -1;6015x /= Math.cos(y);6016}6017return [ x / d3_geo_radians, y / d3_geo_radians ];6018};6019bonne.parallel = function(x) {6020if (!arguments.length) return y1 / d3_geo_radians;6021c1 = 1 / Math.tan(y1 = x * d3_geo_radians);6022return bonne;6023};6024bonne.origin = function(x) {6025if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];6026x0 = x[0] * d3_geo_radians;6027y0 = x[1] * d3_geo_radians;6028return bonne;6029};6030bonne.scale = function(x) {6031if (!arguments.length) return scale;6032scale = +x;6033return bonne;6034};6035bonne.translate = function(x) {6036if (!arguments.length) return translate;6037translate = [ +x[0], +x[1] ];6038return bonne;6039};6040return bonne.origin([ 0, 0 ]).parallel(45);6041};6042d3.geo.equirectangular = function() {6043function equirectangular(coordinates) {6044var x = coordinates[0] / 360, y = -coordinates[1] / 360;6045return [ scale * x + translate[0], scale * y + translate[1] ];6046}6047var scale = 500, translate = [ 480, 250 ];6048equirectangular.invert = function(coordinates) {6049var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;6050return [ 360 * x, -360 * y ];6051};6052equirectangular.scale = function(x) {6053if (!arguments.length) return scale;6054scale = +x;6055return equirectangular;6056};6057equirectangular.translate = function(x) {6058if (!arguments.length) return translate;6059translate = [ +x[0], +x[1] ];6060return equirectangular;6061};6062return equirectangular;6063};6064d3.geo.mercator = function() {6065function mercator(coordinates) {6066var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;6067return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];6068}6069var scale = 500, translate = [ 480, 250 ];6070mercator.invert = function(coordinates) {6071var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;6072return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];6073};6074mercator.scale = function(x) {6075if (!arguments.length) return scale;6076scale = +x;6077return mercator;6078};6079mercator.translate = function(x) {6080if (!arguments.length) return translate;6081translate = [ +x[0], +x[1] ];6082return mercator;6083};6084return mercator;6085};6086d3.geo.path = function() {6087function path(d, i) {6088if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));6089pathType(d);6090var result = buffer.length ? buffer.join("") : null;6091buffer = [];6092return result;6093}6094function project(coordinates) {6095return projection(coordinates).join(",");6096}6097function polygonArea(coordinates) {6098var sum = area(coordinates[0]), i = 0, n = coordinates.length;6099while (++i < n) sum -= area(coordinates[i]);6100return sum;6101}6102function polygonCentroid(coordinates) {6103var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length;6104while (++i < n) {6105polygon = d3.geom.polygon(coordinates[i].map(projection));6106area = polygon.area();6107centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);6108x -= centroid[0];6109y -= centroid[1];6110z -= area;6111}6112return [ x, y, 6 * z ];6113}6114function area(coordinates) {6115return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());6116}6117var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];6118var pathType = d3_geo_type({6119FeatureCollection: function(o) {6120var features = o.features, i = -1, n = features.length;6121while (++i < n) buffer.push(pathType(features[i].geometry));6122},6123Feature: function(o) {6124pathType(o.geometry);6125},6126Point: function(o) {6127buffer.push("M", project(o.coordinates), pointCircle);6128},6129MultiPoint: function(o) {6130var coordinates = o.coordinates, i = -1, n = coordinates.length;6131while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);6132},6133LineString: function(o) {6134var coordinates = o.coordinates, i = -1, n = coordinates.length;6135buffer.push("M");6136while (++i < n) buffer.push(project(coordinates[i]), "L");6137buffer.pop();6138},6139MultiLineString: function(o) {6140var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;6141while (++i < n) {6142subcoordinates = coordinates[i];6143j = -1;6144m = subcoordinates.length;6145buffer.push("M");6146while (++j < m) buffer.push(project(subcoordinates[j]), "L");6147buffer.pop();6148}6149},6150Polygon: function(o) {6151var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;6152while (++i < n) {6153subcoordinates = coordinates[i];6154j = -1;6155if ((m = subcoordinates.length - 1) > 0) {6156buffer.push("M");6157while (++j < m) buffer.push(project(subcoordinates[j]), "L");6158buffer[buffer.length - 1] = "Z";6159}6160}6161},6162MultiPolygon: function(o) {6163var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;6164while (++i < n) {6165subcoordinates = coordinates[i];6166j = -1;6167m = subcoordinates.length;6168while (++j < m) {6169subsubcoordinates = subcoordinates[j];6170k = -1;6171if ((p = subsubcoordinates.length - 1) > 0) {6172buffer.push("M");6173while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");6174buffer[buffer.length - 1] = "Z";6175}6176}6177}6178},6179GeometryCollection: function(o) {6180var geometries = o.geometries, i = -1, n = geometries.length;6181while (++i < n) buffer.push(pathType(geometries[i]));6182}6183});6184var areaType = path.area = d3_geo_type({6185FeatureCollection: function(o) {6186var area = 0, features = o.features, i = -1, n = features.length;6187while (++i < n) area += areaType(features[i]);6188return area;6189},6190Feature: function(o) {6191return areaType(o.geometry);6192},6193Polygon: function(o) {6194return polygonArea(o.coordinates);6195},6196MultiPolygon: function(o) {6197var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;6198while (++i < n) sum += polygonArea(coordinates[i]);6199return sum;6200},6201GeometryCollection: function(o) {6202var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;6203while (++i < n) sum += areaType(geometries[i]);6204return sum;6205}6206}, 0);6207var centroidType = path.centroid = d3_geo_type({6208Feature: function(o) {6209return centroidType(o.geometry);6210},6211Polygon: function(o) {6212var centroid = polygonCentroid(o.coordinates);6213return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];6214},6215MultiPolygon: function(o) {6216var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;6217while (++i < n) {6218centroid = polygonCentroid(coordinates[i]);6219x += centroid[0];6220y += centroid[1];6221z += centroid[2];6222}6223return [ x / z, y / z ];6224}6225});6226path.projection = function(x) {6227projection = x;6228return path;6229};6230path.pointRadius = function(x) {6231if (typeof x === "function") pointRadius = x; else {6232pointRadius = +x;6233pointCircle = d3_path_circle(pointRadius);6234}6235return path;6236};6237return path;6238};6239d3.geo.bounds = function(feature) {6240var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;6241d3_geo_bounds(feature, function(x, y) {6242if (x < left) left = x;6243if (x > right) right = x;6244if (y < bottom) bottom = y;6245if (y > top) top = y;6246});6247return [ [ left, bottom ], [ right, top ] ];6248};6249var d3_geo_boundsTypes = {6250Feature: d3_geo_boundsFeature,6251FeatureCollection: d3_geo_boundsFeatureCollection,6252GeometryCollection: d3_geo_boundsGeometryCollection,6253LineString: d3_geo_boundsLineString,6254MultiLineString: d3_geo_boundsMultiLineString,6255MultiPoint: d3_geo_boundsLineString,6256MultiPolygon: d3_geo_boundsMultiPolygon,6257Point: d3_geo_boundsPoint,6258Polygon: d3_geo_boundsPolygon6259};6260d3.geo.circle = function() {6261function circle() {}6262function visible(point) {6263return arc.distance(point) < radians;6264}6265function clip(coordinates) {6266var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;6267while (++i < n) {6268d1 = arc.distance(p2 = coordinates[i]);6269if (d1 < radians) {6270if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));6271clipped.push(p2);6272p0 = p1 = null;6273} else {6274p1 = p2;6275if (!p0 && clipped.length) {6276clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));6277p0 = p1;6278}6279}6280d0 = d1;6281}6282p0 = coordinates[0];6283p1 = clipped[0];6284if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {6285clipped.push(p1);6286}6287return resample(clipped);6288}6289function resample(coordinates) {6290var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();6291while (++i < n) {6292resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;6293for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);6294}6295arc.source(origin);6296return resampled;6297}6298var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);6299circle.clip = function(d) {6300if (typeof origin === "function") arc.source(origin.apply(this, arguments));6301return clipType(d) || null;6302};6303var clipType = d3_geo_type({6304FeatureCollection: function(o) {6305var features = o.features.map(clipType).filter(d3_identity);6306return features && (o = Object.create(o), o.features = features, o);6307},6308Feature: function(o) {6309var geometry = clipType(o.geometry);6310return geometry && (o = Object.create(o), o.geometry = geometry, o);6311},6312Point: function(o) {6313return visible(o.coordinates) && o;6314},6315MultiPoint: function(o) {6316var coordinates = o.coordinates.filter(visible);6317return coordinates.length && {6318type: o.type,6319coordinates: coordinates6320};6321},6322LineString: function(o) {6323var coordinates = clip(o.coordinates);6324return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);6325},6326MultiLineString: function(o) {6327var coordinates = o.coordinates.map(clip).filter(function(d) {6328return d.length;6329});6330return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);6331},6332Polygon: function(o) {6333var coordinates = o.coordinates.map(clip);6334return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);6335},6336MultiPolygon: function(o) {6337var coordinates = o.coordinates.map(function(d) {6338return d.map(clip);6339}).filter(function(d) {6340return d[0].length;6341});6342return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);6343},6344GeometryCollection: function(o) {6345var geometries = o.geometries.map(clipType).filter(d3_identity);6346return geometries.length && (o = Object.create(o), o.geometries = geometries, o);6347}6348});6349circle.origin = function(x) {6350if (!arguments.length) return origin;6351origin = x;6352if (typeof origin !== "function") arc.source(origin);6353return circle;6354};6355circle.angle = function(x) {6356if (!arguments.length) return degrees;6357radians = (degrees = +x) * d3_geo_radians;6358return circle;6359};6360return d3.rebind(circle, arc, "precision");6361};6362d3.geo.greatArc = function() {6363function greatArc() {6364var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];6365while ((t += dt) < 1) coordinates.push(interpolate(t));6366coordinates.push(p1);6367return {6368type: "LineString",6369coordinates: coordinates6370};6371}6372var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();6373greatArc.distance = function() {6374if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));6375if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));6376return interpolate.distance();6377};6378greatArc.source = function(_) {6379if (!arguments.length) return source;6380source = _;6381if (typeof source !== "function") interpolate.source(p0 = source);6382return greatArc;6383};6384greatArc.target = function(_) {6385if (!arguments.length) return target;6386target = _;6387if (typeof target !== "function") interpolate.target(p1 = target);6388return greatArc;6389};6390greatArc.precision = function(_) {6391if (!arguments.length) return precision / d3_geo_radians;6392precision = _ * d3_geo_radians;6393return greatArc;6394};6395return greatArc;6396};6397d3.geo.greatCircle = d3.geo.circle;6398d3.geom = {};6399d3.geom.contour = function(grid, start) {6400var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;6401do {6402i = 0;6403if (grid(x - 1, y - 1)) i += 1;6404if (grid(x, y - 1)) i += 2;6405if (grid(x - 1, y)) i += 4;6406if (grid(x, y)) i += 8;6407if (i === 6) {6408dx = pdy === -1 ? -1 : 1;6409dy = 0;6410} else if (i === 9) {6411dx = 0;6412dy = pdx === 1 ? -1 : 1;6413} else {6414dx = d3_geom_contourDx[i];6415dy = d3_geom_contourDy[i];6416}6417if (dx != pdx && dy != pdy) {6418c.push([ x, y ]);6419pdx = dx;6420pdy = dy;6421}6422x += dx;6423y += dy;6424} while (s[0] != x || s[1] != y);6425return c;6426};6427var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ];6428d3.geom.hull = function(vertices) {6429if (vertices.length < 3) return [];6430var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;6431for (i = 1; i < len; ++i) {6432if (vertices[i][1] < vertices[h][1]) {6433h = i;6434} else if (vertices[i][1] == vertices[h][1]) {6435h = vertices[i][0] < vertices[h][0] ? i : h;6436}6437}6438for (i = 0; i < len; ++i) {6439if (i === h) continue;6440y1 = vertices[i][1] - vertices[h][1];6441x1 = vertices[i][0] - vertices[h][0];6442points.push({6443angle: Math.atan2(y1, x1),6444index: i6445});6446}6447points.sort(function(a, b) {6448return a.angle - b.angle;6449});6450a = points[0].angle;6451v = points[0].index;6452u = 0;6453for (i = 1; i < plen; ++i) {6454j = points[i].index;6455if (a == points[i].angle) {6456x1 = vertices[v][0] - vertices[h][0];6457y1 = vertices[v][1] - vertices[h][1];6458x2 = vertices[j][0] - vertices[h][0];6459y2 = vertices[j][1] - vertices[h][1];6460if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {6461points[i].index = -1;6462} else {6463points[u].index = -1;6464a = points[i].angle;6465u = i;6466v = j;6467}6468} else {6469a = points[i].angle;6470u = i;6471v = j;6472}6473}6474stack.push(h);6475for (i = 0, j = 0; i < 2; ++j) {6476if (points[j].index !== -1) {6477stack.push(points[j].index);6478i++;6479}6480}6481sp = stack.length;6482for (; j < plen; ++j) {6483if (points[j].index === -1) continue;6484while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {6485--sp;6486}6487stack[sp++] = points[j].index;6488}6489var poly = [];6490for (i = 0; i < sp; ++i) {6491poly.push(vertices[stack[i]]);6492}6493return poly;6494};6495d3.geom.polygon = function(coordinates) {6496coordinates.area = function() {6497var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];6498while (++i < n) {6499a += coordinates[i - 1][0] * coordinates[i][1];6500b += coordinates[i - 1][1] * coordinates[i][0];6501}6502return (b - a) * .5;6503};6504coordinates.centroid = function(k) {6505var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;6506if (!arguments.length) k = -1 / (6 * coordinates.area());6507while (++i < n) {6508a = b;6509b = coordinates[i];6510c = a[0] * b[1] - b[0] * a[1];6511x += (a[0] + b[0]) * c;6512y += (a[1] + b[1]) * c;6513}6514return [ x * k, y * k ];6515};6516coordinates.clip = function(subject) {6517var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;6518while (++i < n) {6519input = subject.slice();6520subject.length = 0;6521b = coordinates[i];6522c = input[(m = input.length) - 1];6523j = -1;6524while (++j < m) {6525d = input[j];6526if (d3_geom_polygonInside(d, a, b)) {6527if (!d3_geom_polygonInside(c, a, b)) {6528subject.push(d3_geom_polygonIntersect(c, d, a, b));6529}6530subject.push(d);6531} else if (d3_geom_polygonInside(c, a, b)) {6532subject.push(d3_geom_polygonIntersect(c, d, a, b));6533}6534c = d;6535}6536a = b;6537}6538return subject;6539};6540return coordinates;6541};6542d3.geom.voronoi = function(vertices) {6543var polygons = vertices.map(function() {6544return [];6545});6546d3_voronoi_tessellate(vertices, function(e) {6547var s1, s2, x1, x2, y1, y2;6548if (e.a === 1 && e.b >= 0) {6549s1 = e.ep.r;6550s2 = e.ep.l;6551} else {6552s1 = e.ep.l;6553s2 = e.ep.r;6554}6555if (e.a === 1) {6556y1 = s1 ? s1.y : -1e6;6557x1 = e.c - e.b * y1;6558y2 = s2 ? s2.y : 1e6;6559x2 = e.c - e.b * y2;6560} else {6561x1 = s1 ? s1.x : -1e6;6562y1 = e.c - e.a * x1;6563x2 = s2 ? s2.x : 1e6;6564y2 = e.c - e.a * x2;6565}6566var v1 = [ x1, y1 ], v2 = [ x2, y2 ];6567polygons[e.region.l.index].push(v1, v2);6568polygons[e.region.r.index].push(v1, v2);6569});6570return polygons.map(function(polygon, i) {6571var cx = vertices[i][0], cy = vertices[i][1];6572polygon.forEach(function(v) {6573v.angle = Math.atan2(v[0] - cx, v[1] - cy);6574});6575return polygon.sort(function(a, b) {6576return a.angle - b.angle;6577}).filter(function(d, i) {6578return !i || d.angle - polygon[i - 1].angle > 1e-10;6579});6580});6581};6582var d3_voronoi_opposite = {6583l: "r",6584r: "l"6585};6586d3.geom.delaunay = function(vertices) {6587var edges = vertices.map(function() {6588return [];6589}), triangles = [];6590d3_voronoi_tessellate(vertices, function(e) {6591edges[e.region.l.index].push(vertices[e.region.r.index]);6592});6593edges.forEach(function(edge, i) {6594var v = vertices[i], cx = v[0], cy = v[1];6595edge.forEach(function(v) {6596v.angle = Math.atan2(v[0] - cx, v[1] - cy);6597});6598edge.sort(function(a, b) {6599return a.angle - b.angle;6600});6601for (var j = 0, m = edge.length - 1; j < m; j++) {6602triangles.push([ v, edge[j], edge[j + 1] ]);6603}6604});6605return triangles;6606};6607d3.geom.quadtree = function(points, x1, y1, x2, y2) {6608function insert(n, p, x1, y1, x2, y2) {6609if (isNaN(p.x) || isNaN(p.y)) return;6610if (n.leaf) {6611var v = n.point;6612if (v) {6613if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {6614insertChild(n, p, x1, y1, x2, y2);6615} else {6616n.point = null;6617insertChild(n, v, x1, y1, x2, y2);6618insertChild(n, p, x1, y1, x2, y2);6619}6620} else {6621n.point = p;6622}6623} else {6624insertChild(n, p, x1, y1, x2, y2);6625}6626}6627function insertChild(n, p, x1, y1, x2, y2) {6628var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;6629n.leaf = false;6630n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());6631if (right) x1 = sx; else x2 = sx;6632if (bottom) y1 = sy; else y2 = sy;6633insert(n, p, x1, y1, x2, y2);6634}6635var p, i = -1, n = points.length;6636if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);6637if (arguments.length < 5) {6638if (arguments.length === 3) {6639y2 = x2 = y1;6640y1 = x1;6641} else {6642x1 = y1 = Infinity;6643x2 = y2 = -Infinity;6644while (++i < n) {6645p = points[i];6646if (p.x < x1) x1 = p.x;6647if (p.y < y1) y1 = p.y;6648if (p.x > x2) x2 = p.x;6649if (p.y > y2) y2 = p.y;6650}6651var dx = x2 - x1, dy = y2 - y1;6652if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;6653}6654}6655var root = d3_geom_quadtreeNode();6656root.add = function(p) {6657insert(root, p, x1, y1, x2, y2);6658};6659root.visit = function(f) {6660d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);6661};6662points.forEach(root.add);6663return root;6664};6665d3.time = {};6666var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];6667d3_time_utc.prototype = {6668getDate: function() {6669return this._.getUTCDate();6670},6671getDay: function() {6672return this._.getUTCDay();6673},6674getFullYear: function() {6675return this._.getUTCFullYear();6676},6677getHours: function() {6678return this._.getUTCHours();6679},6680getMilliseconds: function() {6681return this._.getUTCMilliseconds();6682},6683getMinutes: function() {6684return this._.getUTCMinutes();6685},6686getMonth: function() {6687return this._.getUTCMonth();6688},6689getSeconds: function() {6690return this._.getUTCSeconds();6691},6692getTime: function() {6693return this._.getTime();6694},6695getTimezoneOffset: function() {6696return 0;6697},6698valueOf: function() {6699return this._.valueOf();6700},6701setDate: function() {6702d3_time_prototype.setUTCDate.apply(this._, arguments);6703},6704setDay: function() {6705d3_time_prototype.setUTCDay.apply(this._, arguments);6706},6707setFullYear: function() {6708d3_time_prototype.setUTCFullYear.apply(this._, arguments);6709},6710setHours: function() {6711d3_time_prototype.setUTCHours.apply(this._, arguments);6712},6713setMilliseconds: function() {6714d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);6715},6716setMinutes: function() {6717d3_time_prototype.setUTCMinutes.apply(this._, arguments);6718},6719setMonth: function() {6720d3_time_prototype.setUTCMonth.apply(this._, arguments);6721},6722setSeconds: function() {6723d3_time_prototype.setUTCSeconds.apply(this._, arguments);6724},6725setTime: function() {6726d3_time_prototype.setTime.apply(this._, arguments);6727}6728};6729var d3_time_prototype = Date.prototype;6730var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";6731var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate);6732d3.time.format = function(template) {6733function format(date) {6734var string = [], i = -1, j = 0, c, f;6735while (++i < n) {6736if (template.charCodeAt(i) == 37) {6737string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);6738j = i + 1;6739}6740}6741string.push(template.substring(j, i));6742return string.join("");6743}6744var n = template.length;6745format.parse = function(string) {6746var d = {6747y: 1900,6748m: 0,6749d: 1,6750H: 0,6751M: 0,6752S: 0,6753L: 06754}, i = d3_time_parse(d, template, string, 0);6755if (i != string.length) return null;6756if ("p" in d) d.H = d.H % 12 + d.p * 12;6757var date = new d3_time;6758date.setFullYear(d.y, d.m, d.d);6759date.setHours(d.H, d.M, d.S, d.L);6760return date;6761};6762format.toString = function() {6763return template;6764};6765return format;6766};6767var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d");6768var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);6769var d3_time_formats = {6770a: function(d) {6771return d3_time_dayAbbreviations[d.getDay()];6772},6773A: function(d) {6774return d3_time_days[d.getDay()];6775},6776b: function(d) {6777return d3_time_monthAbbreviations[d.getMonth()];6778},6779B: function(d) {6780return d3_time_months[d.getMonth()];6781},6782c: d3.time.format(d3_time_formatDateTime),6783d: function(d) {6784return d3_time_zfill2(d.getDate());6785},6786e: function(d) {6787return d3_time_sfill2(d.getDate());6788},6789H: function(d) {6790return d3_time_zfill2(d.getHours());6791},6792I: function(d) {6793return d3_time_zfill2(d.getHours() % 12 || 12);6794},6795j: function(d) {6796return d3_time_zfill3(1 + d3.time.dayOfYear(d));6797},6798L: function(d) {6799return d3_time_zfill3(d.getMilliseconds());6800},6801m: function(d) {6802return d3_time_zfill2(d.getMonth() + 1);6803},6804M: function(d) {6805return d3_time_zfill2(d.getMinutes());6806},6807p: function(d) {6808return d.getHours() >= 12 ? "PM" : "AM";6809},6810S: function(d) {6811return d3_time_zfill2(d.getSeconds());6812},6813U: function(d) {6814return d3_time_zfill2(d3.time.sundayOfYear(d));6815},6816w: function(d) {6817return d.getDay();6818},6819W: function(d) {6820return d3_time_zfill2(d3.time.mondayOfYear(d));6821},6822x: d3.time.format(d3_time_formatDate),6823X: d3.time.format(d3_time_formatTime),6824y: function(d) {6825return d3_time_zfill2(d.getFullYear() % 100);6826},6827Y: function(d) {6828return d3_time_zfill4(d.getFullYear() % 1e4);6829},6830Z: d3_time_zone,6831"%": function(d) {6832return "%";6833}6834};6835var d3_time_parsers = {6836a: d3_time_parseWeekdayAbbrev,6837A: d3_time_parseWeekday,6838b: d3_time_parseMonthAbbrev,6839B: d3_time_parseMonth,6840c: d3_time_parseLocaleFull,6841d: d3_time_parseDay,6842e: d3_time_parseDay,6843H: d3_time_parseHour24,6844I: d3_time_parseHour24,6845L: d3_time_parseMilliseconds,6846m: d3_time_parseMonthNumber,6847M: d3_time_parseMinutes,6848p: d3_time_parseAmPm,6849S: d3_time_parseSeconds,6850x: d3_time_parseLocaleDate,6851X: d3_time_parseLocaleTime,6852y: d3_time_parseYear,6853Y: d3_time_parseFullYear6854};6855var d3_time_numberRe = /^\s*\d+/;6856var d3_time_amPmLookup = d3.map({6857am: 0,6858pm: 16859});6860d3.time.format.utc = function(template) {6861function format(date) {6862try {6863d3_time = d3_time_utc;6864var utc = new d3_time;6865utc._ = date;6866return local(utc);6867} finally {6868d3_time = Date;6869}6870}6871var local = d3.time.format(template);6872format.parse = function(string) {6873try {6874d3_time = d3_time_utc;6875var date = local.parse(string);6876return date && date._;6877} finally {6878d3_time = Date;6879}6880};6881format.toString = local.toString;6882return format;6883};6884var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");6885d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;6886d3_time_formatIsoNative.parse = function(string) {6887var date = new Date(string);6888return isNaN(date) ? null : date;6889};6890d3_time_formatIsoNative.toString = d3_time_formatIso.toString;6891d3.time.second = d3_time_interval(function(date) {6892return new d3_time(Math.floor(date / 1e3) * 1e3);6893}, function(date, offset) {6894date.setTime(date.getTime() + Math.floor(offset) * 1e3);6895}, function(date) {6896return date.getSeconds();6897});6898d3.time.seconds = d3.time.second.range;6899d3.time.seconds.utc = d3.time.second.utc.range;6900d3.time.minute = d3_time_interval(function(date) {6901return new d3_time(Math.floor(date / 6e4) * 6e4);6902}, function(date, offset) {6903date.setTime(date.getTime() + Math.floor(offset) * 6e4);6904}, function(date) {6905return date.getMinutes();6906});6907d3.time.minutes = d3.time.minute.range;6908d3.time.minutes.utc = d3.time.minute.utc.range;6909d3.time.hour = d3_time_interval(function(date) {6910var timezone = date.getTimezoneOffset() / 60;6911return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);6912}, function(date, offset) {6913date.setTime(date.getTime() + Math.floor(offset) * 36e5);6914}, function(date) {6915return date.getHours();6916});6917d3.time.hours = d3.time.hour.range;6918d3.time.hours.utc = d3.time.hour.utc.range;6919d3.time.day = d3_time_interval(function(date) {6920var day = new d3_time(1970, 0);6921day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());6922return day;6923}, function(date, offset) {6924date.setDate(date.getDate() + offset);6925}, function(date) {6926return date.getDate() - 1;6927});6928d3.time.days = d3.time.day.range;6929d3.time.days.utc = d3.time.day.utc.range;6930d3.time.dayOfYear = function(date) {6931var year = d3.time.year(date);6932return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);6933};6934d3_time_daySymbols.forEach(function(day, i) {6935day = day.toLowerCase();6936i = 7 - i;6937var interval = d3.time[day] = d3_time_interval(function(date) {6938(date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);6939return date;6940}, function(date, offset) {6941date.setDate(date.getDate() + Math.floor(offset) * 7);6942}, function(date) {6943var day = d3.time.year(date).getDay();6944return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);6945});6946d3.time[day + "s"] = interval.range;6947d3.time[day + "s"].utc = interval.utc.range;6948d3.time[day + "OfYear"] = function(date) {6949var day = d3.time.year(date).getDay();6950return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);6951};6952});6953d3.time.week = d3.time.sunday;6954d3.time.weeks = d3.time.sunday.range;6955d3.time.weeks.utc = d3.time.sunday.utc.range;6956d3.time.weekOfYear = d3.time.sundayOfYear;6957d3.time.month = d3_time_interval(function(date) {6958date = d3.time.day(date);6959date.setDate(1);6960return date;6961}, function(date, offset) {6962date.setMonth(date.getMonth() + offset);6963}, function(date) {6964return date.getMonth();6965});6966d3.time.months = d3.time.month.range;6967d3.time.months.utc = d3.time.month.utc.range;6968d3.time.year = d3_time_interval(function(date) {6969date = d3.time.day(date);6970date.setMonth(0, 1);6971return date;6972}, function(date, offset) {6973date.setFullYear(date.getFullYear() + offset);6974}, function(date) {6975return date.getFullYear();6976});6977d3.time.years = d3.time.year.range;6978d3.time.years.utc = d3.time.year.utc.range;6979var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];6980var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];6981var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {6982return true;6983} ], [ d3.time.format("%B"), function(d) {6984return d.getMonth();6985} ], [ d3.time.format("%b %d"), function(d) {6986return d.getDate() != 1;6987} ], [ d3.time.format("%a %d"), function(d) {6988return d.getDay() && d.getDate() != 1;6989} ], [ d3.time.format("%I %p"), function(d) {6990return d.getHours();6991} ], [ d3.time.format("%I:%M"), function(d) {6992return d.getMinutes();6993} ], [ d3.time.format(":%S"), function(d) {6994return d.getSeconds();6995} ], [ d3.time.format(".%L"), function(d) {6996return d.getMilliseconds();6997} ] ];6998var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);6999d3_time_scaleLocalMethods.year = function(extent, m) {7000return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);7001};7002d3.time.scale = function() {7003return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);7004};7005var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {7006return [ m[0].utc, m[1] ];7007});7008var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {7009return true;7010} ], [ d3.time.format.utc("%B"), function(d) {7011return d.getUTCMonth();7012} ], [ d3.time.format.utc("%b %d"), function(d) {7013return d.getUTCDate() != 1;7014} ], [ d3.time.format.utc("%a %d"), function(d) {7015return d.getUTCDay() && d.getUTCDate() != 1;7016} ], [ d3.time.format.utc("%I %p"), function(d) {7017return d.getUTCHours();7018} ], [ d3.time.format.utc("%I:%M"), function(d) {7019return d.getUTCMinutes();7020} ], [ d3.time.format.utc(":%S"), function(d) {7021return d.getUTCSeconds();7022} ], [ d3.time.format.utc(".%L"), function(d) {7023return d.getUTCMilliseconds();7024} ] ];7025var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);7026d3_time_scaleUTCMethods.year = function(extent, m) {7027return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);7028};7029d3.time.scale.utc = function() {7030return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);7031};7032})();70337034