From 86082a017c1c0294257a9c2fe78a2ff708641611 Mon Sep 17 00:00:00 2001 From: Mick Muzac Date: Tue, 10 Jun 2014 14:18:11 -0400 Subject: [PATCH] Fixed child event passing bug --- dist/xapicollection.min.js | 2 +- dist/xapidashboard.js | 6 ++- dist/xapidashboard.min.js | 4 +- examples/childcharts.html | 85 ++++++-------------------------------- package.json | 2 +- src/chart.js | 6 ++- 6 files changed, 25 insertions(+), 80 deletions(-) diff --git a/dist/xapicollection.min.js b/dist/xapicollection.min.js index 10ad3a8..0234d47 100644 --- a/dist/xapicollection.min.js +++ b/dist/xapicollection.min.js @@ -1,2 +1,2 @@ -/*! xAPI-Dashboard v1.0.0 | Built on 06-10-2014 */ +/*! xAPI-Dashboard v1.0.1 | Built on 06-10-2014 */ "use strict";try{window.ADL=window.ADL||{}}catch(e){var window={ADL:{}}}try{var workerScript=document.querySelector('script[src*="xapicollection"]').src}catch(e){}Array.isArray||(Array.isArray=function(a){return a.length>=0&&!a.length}),function(a){function b(a,c){if(void 0===c)return null;if(0===a.length)return c;var d;if(Array.isArray(a))d=a;else{d=a.split(".");for(var e=0;e0&&console.log("Warning: Your browser does not support WebWorker transfers. Performance of this site may suffer as a result.")}function e(a){return function(){var b=Array.prototype.slice.call(arguments);return this._worker.postMessage(d.serialize([a].concat(b))),this}}c.prototype.exec=function(a){return a(this.contents),this.parent},c.prototype.save=function(){return new c(this)},c.prototype.append=function(a){return this.contents=this.contents.concat(a),this},c.prototype.where=function(a){function c(a){function b(a){var c=/^\s*\((.*)\)\s*$/.exec(a);return c?b(c[1]):d(a)}function c(a){for(var b=0,c=0;c=|<=|=|>|<)\s*(.*)\s*$/.exec(a);if(!b)return e;var c=h(b[1]),d=i(b[3]);if(!c)return e;if(d instanceof RegExp)return"="===b[2]?{op:"re",xpath:c,value:d}:"!="===b[2]?{op:"nre",xpath:c,value:d}:(console.error("Regex comparison only supports = and !="),e);switch(b[2]){case"=":return{op:"eq",xpath:c,value:d};case"!=":return{op:"neq",xpath:c,value:d};case"<":return{op:"lt",xpath:c,value:d};case"<=":return{op:"leq",xpath:c,value:d};case">":return{op:"gt",xpath:c,value:d};case">=":return{op:"geq",xpath:c,value:d};default:return e}}function h(a){var b=/^\s*([^\.]+(?:\.[^\.]+)*)\s*$/.exec(a);return b?b[1]:e}function i(a){var b=null;a=a.trim();var c=Number.isNaN||isNaN;return c(b=parseFloat(a))?(b=/^\s*"(.*)"\s*$/.exec(a))?b[1]:(b=/^\s*\/(.*)\/(i?)\s*$/.exec(a))?new RegExp(b[1],b[2]):"null"===a?null:"true"===a||"false"===a?"true"===a:e:b}var j=b(a);return j!=e?j:null}function d(a,c){if(Array.isArray(a.and)&&0===a.and.length)return!0;if(Array.isArray(a.or)&&0===a.or.length)return!1;if(!a.op)return a.and?d(a.and[0],c)?d({and:a.and.slice(1)},c):!1:a.or?d(a.or[0],c)?!0:d({or:a.or.slice(1)},c):!1;switch(a.op){case"eq":return b(a.xpath,c)===a.value;case"neq":return b(a.xpath,c)!==a.value;case"geq":return b(a.xpath,c)>=a.value;case"leq":return b(a.xpath,c)<=a.value;case"lt":return b(a.xpath,c)a.value;case"re":return a.value.test(b(a.xpath,c));case"nre":return!a.value.test(b(a.xpath,c));default:return!1}}var e=0/0;if(!a)return this;var f=c(a);if(!f)return void console.error("Invalid where expression: "+a);for(var g=0;g0)for(var e=this.contents,f=0;f0)for(var g=0;gf?-1:1)*c}),this},c.prototype._groupByRange=function(a,c){if(!Array.isArray(c)||3!==c.length||c[2]%1!==0)return this.groupBy(a);var d,e,f=c[0],g=c[1],h=c[2];"string"==typeof f&&"string"==typeof g&&Date.parse(f)&&Date.parse(g)?(d=function(a){return Date.parse(a)},e=function(a,b){var c=new Date(Date.parse(a)+b);return c.toISOString()}):"string"==typeof f&&"string"==typeof g?(d=function(a){return a.charAt(0).toLowerCase().charCodeAt(0)-"a".charCodeAt(0)},e=function(a,b){return String.fromCharCode(a.charAt(0).toLowerCase().charCodeAt(0)+b)}):(d=function(a){return a},e=function(a,b){return a+b});var i=[];if((d(g)-d(f))*h<=0)console.error("Group range is open, cannot generate groups!"),console.log(JSON.stringify(c)),i=[f,g];else{if(d(f)>d(g))return groupByRange(a,[g,f,-h]),void dataStack.push(dataStack.pop().reverse());for(var j=f;d(j)0){for(var d=0;d0){for(var f=0;f0){for(var f=0;f0?h/j.data.length:0,j.sample=j.data[0],g.push(j)}return this.contents=g,this},c.prototype.min=function(a,d){if(!a)return this;var e=this.contents,f=[];if(e[0]&&e[0].group&&e[0].data){if(d&&d>0){for(var g=0;g0){for(var f=0;fsg&&(lg.scrollX||lg.scrollY)){c=jg.select(kg.body).append("svg").style("position","absolute").style("top",0).style("left",0);var e=c[0][0].getScreenCTM();sg=!(e.f||e.e),c.remove()}return sg?(d.x=b.pageX,d.y=b.pageY):(d.x=b.clientX,d.y=b.clientY),d=d.matrixTransform(a.getScreenCTM().inverse()),[d.x,d.y]}var f=a.getBoundingClientRect();return[b.clientX-f.left-a.clientLeft,b.clientY-f.top-a.clientTop]}function p(a){for(var b=-1,c=a.length,d=[];++b0&&(a=a.substring(0,h));var j=Eg.get(a);return j&&(a=j,i=H),h?b?e:d:b?E:f}function G(a,b){return function(c){var d=jg.event;jg.event=c,b[0]=this.__data__;try{a.apply(this,b)}finally{jg.event=d}}}function H(a,b){var c=G(a,b);return function(a){var b=this,d=a.relatedTarget;d&&(d===b||8&d.compareDocumentPosition(b))||c.call(b,a)}}function I(a,b){for(var c=0,d=a.length;d>c;c++)for(var e,f=a[c],g=0,h=f.length;h>g;g++)(e=f[g])&&b(e,g,c);return a}function J(a){return vg(a,Fg),a}function K(){}function L(a,b,c){return new M(a,b,c)}function M(a,b,c){this.h=a,this.s=b,this.l=c}function N(a,b,c){function d(a){return a>360?a-=360:0>a&&(a+=360),60>a?f+(g-f)*a/60:180>a?g:240>a?f+(g-f)*(240-a)/60:f}function e(a){return Math.round(255*d(a))}var f,g;return a%=360,0>a&&(a+=360),b=0>b?0:b>1?1:b,c=0>c?0:c>1?1:c,g=.5>=c?c*(1+b):c+b-c*b,f=2*c-g,cb(e(a+120),e(a),e(a-120))}function O(a){return a>0?1:0>a?-1:0}function P(a){return Math.acos(Math.max(-1,Math.min(1,a)))}function Q(a){return a>1?Lg/2:-1>a?-Lg/2:Math.asin(a)}function R(a){return(Math.exp(a)-Math.exp(-a))/2}function S(a){return(Math.exp(a)+Math.exp(-a))/2}function T(a){return(a=Math.sin(a/2))*a}function U(a,b,c){return new V(a,b,c)}function V(a,b,c){this.h=a,this.c=b,this.l=c}function W(a,b,c){return X(c,Math.cos(a*=Ng)*b,Math.sin(a)*b)}function X(a,b,c){return new Y(a,b,c)}function Y(a,b,c){this.l=a,this.a=b,this.b=c}function Z(a,b,c){var d=(a+16)/116,e=d+b/500,f=d-c/200;return e=_(e)*Rg,d=_(d)*Sg,f=_(f)*Tg,cb(bb(3.2404542*e-1.5371385*d-.4985314*f),bb(-.969266*e+1.8760108*d+.041556*f),bb(.0556434*e-.2040259*d+1.0572252*f))}function $(a,b,c){return U(Math.atan2(c,b)*Og,Math.sqrt(b*b+c*c),a)}function _(a){return a>.206893034?a*a*a:(a-4/29)/7.787037}function ab(a){return a>.008856?Math.pow(a,1/3):7.787037*a+4/29}function bb(a){return Math.round(255*(.00304>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055))}function cb(a,b,c){return new db(a,b,c)}function db(a,b,c){this.r=a,this.g=b,this.b=c}function eb(a){return 16>a?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function fb(a,b,c){var d,e,f,g=0,h=0,i=0;if(d=/([a-z]+)\((.*)\)/i.exec(a))switch(e=d[2].split(","),d[1]){case"hsl":return c(parseFloat(e[0]),parseFloat(e[1])/100,parseFloat(e[2])/100);case"rgb":return b(jb(e[0]),jb(e[1]),jb(e[2]))}return(f=Wg.get(a))?b(f.r,f.g,f.b):(null!=a&&"#"===a.charAt(0)&&(4===a.length?(g=a.charAt(1),g+=g,h=a.charAt(2),h+=h,i=a.charAt(3),i+=i):7===a.length&&(g=a.substring(1,3),h=a.substring(3,5),i=a.substring(5,7)),g=parseInt(g,16),h=parseInt(h,16),i=parseInt(i,16)),b(g,h,i))}function gb(a,b,c){var d,e,f=Math.min(a/=255,b/=255,c/=255),g=Math.max(a,b,c),h=g-f,i=(g+f)/2;return h?(e=.5>i?h/(g+f):h/(2-g-f),d=a==g?(b-c)/h+(c>b?6:0):b==g?(c-a)/h+2:(a-b)/h+4,d*=60):e=d=0,L(d,e,i)}function hb(a,b,c){a=ib(a),b=ib(b),c=ib(c);var d=ab((.4124564*a+.3575761*b+.1804375*c)/Rg),e=ab((.2126729*a+.7151522*b+.072175*c)/Sg),f=ab((.0193339*a+.119192*b+.9503041*c)/Tg);return X(116*e-16,500*(d-e),200*(e-f))}function ib(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function jb(a){var b=parseFloat(a);return"%"===a.charAt(a.length-1)?Math.round(2.55*b):b}function kb(a){return"function"==typeof a?a:function(){return a}}function lb(a){return a}function mb(a){return 1===a.length?function(b,c){a(null==b?c:null)}:a}function nb(a,b){function c(a,c,f){arguments.length<3&&(f=c,c=null);var g=jg.xhr(a,b,f);return g.row=function(a){return arguments.length?g.response(null==(c=a)?d:e(a)):c},g.row(c)}function d(a){return c.parse(a.responseText)}function e(a){return function(b){return c.parse(b.responseText,a)}}function f(b){return b.map(h).join(a)}function h(a){return i.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}var i=new RegExp('["'+a+"\n]"),j=a.charCodeAt(0);return c.parse=function(a,b){var d;return c.parseRows(a,function(a,c){if(d)return d(a,c-1);var e=new Function("d","return {"+a.map(function(a,b){return JSON.stringify(a)+": d["+b+"]"}).join(",")+"}");d=b?function(a,c){return b(e(a),c)}:e})},c.parseRows=function(a,b){function c(){if(k>=i)return g;if(e)return e=!1,f;var b=k;if(34===a.charCodeAt(b)){for(var c=b;c++k;){var d=a.charCodeAt(k++),h=1;if(10===d)e=!0;else if(13===d)e=!0,10===a.charCodeAt(k)&&(++k,++h);else if(d!==j)continue;return a.substring(b,k-h)}return a.substring(b)}for(var d,e,f={},g={},h=[],i=a.length,k=0,l=0;(d=c())!==g;){for(var m=[];d!==f&&d!==g;)m.push(d),d=c();(!b||(m=b(m,l++)))&&h.push(m)}return h},c.format=function(b){if(Array.isArray(b[0]))return c.formatRows(b);var d=new g,e=[];return b.forEach(function(a){for(var b in a)d.has(b)||e.push(d.add(b))}),[e.map(h).join(a)].concat(b.map(function(b){return e.map(function(a){return h(b[a])}).join(a)})).join("\n")},c.formatRows=function(a){return a.map(f).join("\n")},c}function ob(){for(var a,b=Date.now(),c=_g;c;)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=pb()-b;d>24?(isFinite(d)&&(clearTimeout(Yg),Yg=setTimeout(ob,d)),Xg=0):(Xg=1,ah(ob))}function pb(){for(var a=null,b=_g,c=1/0;b;)b.flush?(delete $g[b.callback.id],b=a?a.next=b.next:_g=b.next):(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function qb(a,b){var c=Math.pow(10,3*Math.abs(8-b));return{scale:b>8?function(a){return a/c}:function(a){return a*c},symbol:a}}function rb(a,b){return b-(a?Math.ceil(Math.log(a)/Math.LN10):1)}function sb(a){return a+""}function tb(a,b){a&&kh.hasOwnProperty(a.type)&&kh[a.type](a,b)}function ub(a,b,c){var d,e=-1,f=a.length-c;for(b.lineStart();++ea&&(d=a),a>f&&(f=a),e>b&&(e=b),b>g&&(g=b)}function c(){h.point=h.lineEnd=E}var d,e,f,g,h={point:b,lineStart:E,lineEnd:E,polygonStart:function(){h.lineEnd=c},polygonEnd:function(){h.point=b}};return function(b){return g=f=-(d=e=1/0),jg.geo.stream(b,a(h)),[[d,e],[f,g]]}}function yb(a,b){if(!ph){++qh,a*=Ng;var c=Math.cos(b*=Ng);rh+=(c*Math.cos(a)-rh)/qh,sh+=(c*Math.sin(a)-sh)/qh,th+=(Math.sin(b)-th)/qh}}function zb(){var a,b;ph=1,Ab(),ph=2;var c=uh.point;uh.point=function(d,e){c(a=d,b=e)},uh.lineEnd=function(){uh.point(a,b),Bb(),uh.lineEnd=Bb}}function Ab(){function a(a,e){a*=Ng;var f=Math.cos(e*=Ng),g=f*Math.cos(a),h=f*Math.sin(a),i=Math.sin(e),j=Math.atan2(Math.sqrt((j=c*i-d*h)*j+(j=d*g-b*i)*j+(j=b*h-c*g)*j),b*g+c*h+d*i);qh+=j,rh+=j*(b+(b=g)),sh+=j*(c+(c=h)),th+=j*(d+(d=i))}var b,c,d;ph>1||(1>ph&&(ph=1,qh=rh=sh=th=0),uh.point=function(e,f){e*=Ng;var g=Math.cos(f*=Ng);b=g*Math.cos(e),c=g*Math.sin(e),d=Math.sin(f),uh.point=a})}function Bb(){uh.point=yb}function Cb(a){var b=a[0],c=a[1],d=Math.cos(c);return[d*Math.cos(b),d*Math.sin(b),Math.sin(c)]}function Db(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function Eb(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function Fb(a,b){a[0]+=b[0],a[1]+=b[1],a[2]+=b[2]}function Gb(a,b){return[a[0]*b,a[1]*b,a[2]*b]}function Hb(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=b,a[1]/=b,a[2]/=b}function Ib(){return!0}function Jb(a){return[Math.atan2(a[1],a[0]),Math.asin(Math.max(-1,Math.min(1,a[2])))]}function Kb(a,b){return Math.abs(a[0]-b[0])h;++h)e.point((c=a[h])[0],c[1]);return void e.lineEnd()}var i={point:c,points:a,other:null,visited:!1,entry:!0,subject:!0},j={point:c,points:[c],other:i,visited:!1,entry:!1,subject:!1};i.other=j,f.push(i),g.push(j),i={point:d,points:[d],other:null,visited:!1,entry:!1,subject:!0},j={point:d,points:[d],other:i,visited:!1,entry:!0,subject:!1},i.other=j,f.push(i),g.push(j)}}),g.sort(b),Mb(f),Mb(g),f.length){if(c)for(var h=1,i=!c(g[0].point),j=g.length;j>h;++h)g[h].entry=i=!i;for(var k,l,m,n=f[0];;){for(k=n;k.visited;)if((k=k.next)===n)return;l=k.points,e.lineStart();do{if(k.visited=k.other.visited=!0,k.entry){if(k.subject)for(var h=0;h=0;)e.point((m=l[h])[0],m[1])}else d(k.point,k.prev.point,-1,e);k=k.prev}k=k.other,l=k.points}while(!k.visited);e.lineEnd()}}}function Mb(a){if(b=a.length){for(var b,c,d=0,e=a[0];++d1&&2&b&&c.push(c.pop().concat(c.shift())),l.push(c.filter(Ob))}var l,m,n,o,p,q=b(d),r={point:e,lineStart:g,lineEnd:h,polygonStart:function(){r.point=i,r.lineStart=j,r.lineEnd=k,o=!1,n=m=0,l=[],d.polygonStart()},polygonEnd:function(){r.point=e,r.lineStart=g,r.lineEnd=h,l=jg.merge(l),l.length?Lb(l,Rb,null,c,d):(-Mg>m||o&&-Mg>n)&&(d.lineStart(),c(null,null,1,d),d.lineEnd()),d.polygonEnd(),l=null},sphere:function(){d.polygonStart(),d.lineStart(),c(null,null,1,d),d.lineEnd(),d.polygonEnd()}},s=Pb(),t=b(s);return r}}function Ob(a){return a.length>1}function Pb(){var a,b=[];return{lineStart:function(){b.push(a=[])},point:function(b,c){a.push([b,c])},lineEnd:E,buffer:function(){var c=b;return b=[],a=null,c},rejoin:function(){b.length>1&&b.push(b.pop().concat(b.shift()))}}}function Qb(a,b){if(!(c=a.length))return 0;for(var c,d,e,f=0,g=0,h=a[0],i=h[0],j=h[1],k=Math.cos(j),l=Math.atan2(b*Math.sin(i)*k,Math.sin(j)),m=1-b*Math.cos(i)*k,n=l;++f2&&(g+=4*(d-l)):g+=Math.abs(m-2)0?Lg:-Lg,i=Math.abs(f-c);Math.abs(i-Lg)0?Lg/2:-Lg/2),a.point(e,d),a.lineEnd(),a.lineStart(),a.point(h,d),a.point(f,d),b=0):e!==h&&i>=Lg&&(Math.abs(c-e)Mg?Math.atan((Math.sin(b)*(f=Math.cos(d))*Math.sin(c)-Math.sin(d)*(e=Math.cos(b))*Math.sin(a))/(e*f*g)):(b+d)/2}function Ub(a,b,c,d){var e;if(null==a)e=c*Lg/2,d.point(-Lg,e),d.point(0,e),d.point(Lg,e),d.point(Lg,0),d.point(Lg,-e),d.point(0,-e),d.point(-Lg,-e),d.point(-Lg,0),d.point(-Lg,e);else if(Math.abs(a[0]-b[0])>Mg){var f=(a[0]f}function c(a){var c,f,i,j,k;return{lineStart:function(){j=i=!1,k=1},point:function(l,m){var n,o=[l,m],p=b(l,m),q=g?p?0:e(l,m):p?e(l+(0>l?Lg:-Lg),m):0;if(!c&&(j=i=p)&&a.lineStart(),p!==i&&(n=d(c,o),(Kb(c,n)||Kb(o,n))&&(o[0]+=Mg,o[1]+=Mg,p=b(o[0],o[1]))),p!==i)k=0,p?(a.lineStart(),n=d(o,c),a.point(n[0],n[1])):(n=d(c,o),a.point(n[0],n[1]),a.lineEnd()),c=n;else if(h&&c&&g^p){var r;q&f||!(r=d(o,c,!0))||(k=0,g?(a.lineStart(),a.point(r[0][0],r[0][1]),a.point(r[1][0],r[1][1]),a.lineEnd()):(a.point(r[1][0],r[1][1]),a.lineEnd(),a.lineStart(),a.point(r[0][0],r[0][1])))}!p||c&&Kb(c,o)||a.point(o[0],o[1]),c=o,i=p,f=q},lineEnd:function(){i&&a.lineEnd(),c=null},clean:function(){return k|(j&&i)<<1}}}function d(a,b,c){var d=Cb(a),e=Cb(b),g=[1,0,0],h=Eb(d,e),i=Db(h,h),j=h[0],k=i-j*j;if(!k)return!c&&a;var l=f*i/k,m=-f*j/k,n=Eb(g,h),o=Gb(g,l),p=Gb(h,m);Fb(o,p);var q=n,r=Db(o,q),s=Db(q,q),t=r*r-s*(Db(o,o)-1);if(!(0>t)){var u=Math.sqrt(t),v=Gb(q,(-r-u)/s);if(Fb(v,o),v=Jb(v),!c)return v;var w,x=a[0],y=b[0],z=a[1],A=b[1];x>y&&(w=x,x=y,y=w);var B=y-x,C=Math.abs(B-Lg)B;if(!C&&z>A&&(w=z,z=A,A=w),D?C?z+A>0^v[1]<(Math.abs(v[0]-x)Lg^(x<=v[0]&&v[0]<=y)){var E=Gb(q,(-r+u)/s);return Fb(E,o),[v,Jb(E)]}}}function e(b,c){var d=g?a:Lg-a,e=0;return-d>b?e|=1:b>d&&(e|=2),-d>c?e|=4:c>d&&(e|=8),e}var f=Math.cos(a),g=f>0,h=Math.abs(f)>Mg,i=gc(a,6*Ng);return Nb(b,c,i)}function Wb(a,c,d,e){function f(b,e){return Math.abs(b[0]-a)0?0:3:Math.abs(b[0]-d)0?2:1:Math.abs(b[1]-c)0?1:0:e>0?3:2}function g(a,b){return h(a.point,b.point)}function h(a,b){var c=f(a,1),d=f(b,1);return c!==d?c-d:0===c?b[1]-a[1]:1===c?a[0]-b[0]:2===c?a[1]-b[1]:b[0]-a[0]}function i(b,f){var g=f[0]-b[0],h=f[1]-b[1],i=[0,1];return Math.abs(g)0&&(b[0]+=i[0]*g,b[1]+=i[0]*h),!0):!1}return function(j){function k(b){var g=f(b,-1),h=l([0===g||3===g?a:d,g>1?e:c]);return h}function l(a){for(var c=0,d=u.length,e=a[1],f=0;d>f;++f)for(var g=1,h=u[f],i=h.length,j=h[0];i>g;++g)b=h[g],j[1]<=e?b[1]>e&&m(j,b,a)>0&&++c:b[1]<=e&&m(j,b,a)<0&&--c,j=b;return 0!==c}function m(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])}function n(b,g,i,j){var k=0,l=0;if(null==b||(k=f(b,i))!==(l=f(g,i))||h(b,g)<0^i>0){do j.point(0===k||3===k?a:d,k>1?e:c);while((k=(k+i+4)%4)!==l)}else j.point(g[0],g[1])}function o(b,f){return b>=a&&d>=b&&f>=c&&e>=f}function p(a,b){o(a,b)&&j.point(a,b)}function q(){F.point=s,u&&u.push(v=[]),C=!0,B=!1,z=A=0/0}function r(){t&&(s(w,x),y&&B&&E.rejoin(),t.push(E.buffer())),F.point=p,B&&j.lineEnd()}function s(a,b){a=Math.max(-wh,Math.min(wh,a)),b=Math.max(-wh,Math.min(wh,b));var c=o(a,b);if(u&&v.push([a,b]),C)w=a,x=b,y=c,C=!1,c&&(j.lineStart(),j.point(a,b));else if(c&&B)j.point(a,b);else{var d=[z,A],e=[a,b];i(d,e)?(B||(j.lineStart(),j.point(d[0],d[1])),j.point(e[0],e[1]),c||j.lineEnd()):(j.lineStart(),j.point(a,b))}z=a,A=b,B=c}var t,u,v,w,x,y,z,A,B,C,D=j,E=Pb(),F={point:p,lineStart:q,lineEnd:r,polygonStart:function(){j=E,t=[],u=[]},polygonEnd:function(){j=D,(t=jg.merge(t)).length?(j.polygonStart(),Lb(t,g,k,n,j),j.polygonEnd()):l([a,c])&&(j.polygonStart(),j.lineStart(),n(null,null,1,j),j.lineEnd(),j.polygonEnd()),t=u=v=null}};return F}}function Xb(a,b,c){if(Math.abs(b)=a;var d=a/b;if(b>0){if(d>c[1])return!1;d>c[0]&&(c[0]=d)}else{if(d4*d&&p--){var u=g+m,v=h+n,w=i+o,x=Math.sqrt(u*u+v*v+w*w),y=Math.asin(w/=x),z=Math.abs(Math.abs(w)-1)d||Math.abs((r*D+s*E)/t-.5)>.3)&&(c(b,e,f,g,h,i,B,C,z,u/=x,v/=x,w,p,q),q.point(B,C),c(B,C,z,u,v,w,j,k,l,m,n,o,p,q))}}var d=.5,e=16;return b.precision=function(a){return arguments.length?(e=(d=a*a)>0&&16,b):Math.sqrt(d)},b}function $b(a){return _b(function(){return a})()}function _b(a){function b(a){return a=g(a[0]*Ng,a[1]*Ng),[a[0]*k+h,i-a[1]*k]}function c(a){return a=g.invert((a[0]-h)/k,(i-a[1])/k),a&&[a[0]*Og,a[1]*Og]}function d(){g=Yb(f=cc(p,q,r),e);var a=e(n,o);return h=l-a[0]*k,i=m+a[1]*k,b}var e,f,g,h,i,j=Zb(function(a,b){return a=e(a,b),[a[0]*k+h,i-a[1]*k]}),k=150,l=480,m=250,n=0,o=0,p=0,q=0,r=0,s=vh,t=lb,u=null,v=null;return b.stream=function(a){return ac(f,s(j(t(a))))},b.clipAngle=function(a){return arguments.length?(s=null==a?(u=a,vh):Vb((u=+a)*Ng),b):u},b.clipExtent=function(a){return arguments.length?(v=a,t=null==a?lb:Wb(a[0][0],a[0][1],a[1][0],a[1][1]),b):v},b.scale=function(a){return arguments.length?(k=+a,d()):k},b.translate=function(a){return arguments.length?(l=+a[0],m=+a[1],d()):[l,m]},b.center=function(a){return arguments.length?(n=a[0]%360*Ng,o=a[1]%360*Ng,d()):[n*Og,o*Og]},b.rotate=function(a){return arguments.length?(p=a[0]%360*Ng,q=a[1]%360*Ng,r=a.length>2?a[2]%360*Ng:0,d()):[p*Og,q*Og,r*Og]},jg.rebind(b,j,"precision"),function(){return e=a.apply(this,arguments),b.invert=e.invert&&c,d()}}function ac(a,b){return{point:function(c,d){d=a(c*Ng,d*Ng),c=d[0],b.point(c>Lg?c-2*Lg:-Lg>c?c+2*Lg:c,d[1])},sphere:function(){b.sphere()},lineStart:function(){b.lineStart()},lineEnd:function(){b.lineEnd()},polygonStart:function(){b.polygonStart()},polygonEnd:function(){b.polygonEnd()}}}function bc(a,b){return[a,b]}function cc(a,b,c){return a?b||c?Yb(ec(a),fc(b,c)):ec(a):b||c?fc(b,c):bc}function dc(a){return function(b,c){return b+=a,[b>Lg?b-2*Lg:-Lg>b?b+2*Lg:b,c]}}function ec(a){var b=dc(a);return b.invert=dc(-a),b}function fc(a,b){function c(a,b){var c=Math.cos(b),h=Math.cos(a)*c,i=Math.sin(a)*c,j=Math.sin(b),k=j*d+h*e;return[Math.atan2(i*f-k*g,h*d-j*e),Math.asin(Math.max(-1,Math.min(1,k*f+i*g)))]}var d=Math.cos(a),e=Math.sin(a),f=Math.cos(b),g=Math.sin(b);return c.invert=function(a,b){var c=Math.cos(b),h=Math.cos(a)*c,i=Math.sin(a)*c,j=Math.sin(b),k=j*f-i*g;return[Math.atan2(i*f+j*g,h*d+k*e),Math.asin(Math.max(-1,Math.min(1,k*d-h*e)))]},c}function gc(a,b){var c=Math.cos(a),d=Math.sin(a);return function(e,f,g,h){null!=e?(e=hc(c,e),f=hc(c,f),(g>0?f>e:e>f)&&(e+=2*g*Lg)):(e=a+2*g*Lg,f=a);for(var i,j=g*b,k=e;g>0?k>f:f>k;k-=j)h.point((i=Jb([c,-d*Math.cos(k),-d*Math.sin(k)]))[0],i[1])}}function hc(a,b){var c=Cb(b);c[0]-=a,Hb(c);var d=P(-c[1]);return((-c[2]<0?-d:d)+2*Math.PI-Mg)%(2*Math.PI)}function ic(a,b,c){var d=jg.range(a,b-Mg,c).concat(b);return function(a){return d.map(function(b){return[a,b]})}}function jc(a,b,c){var d=jg.range(a,b-Mg,c).concat(b);return function(a){return d.map(function(b){return[b,a]})}}function kc(a){return a.source}function lc(a){return a.target}function mc(a,b,c,d){var e=Math.cos(b),f=Math.sin(b),g=Math.cos(d),h=Math.sin(d),i=e*Math.cos(a),j=e*Math.sin(a),k=g*Math.cos(c),l=g*Math.sin(c),m=2*Math.asin(Math.sqrt(T(d-b)+e*g*T(c-a))),n=1/Math.sin(m),o=m?function(a){var b=Math.sin(a*=m)*n,c=Math.sin(m-a)*n,d=c*i+b*k,e=c*j+b*l,g=c*f+b*h;return[Math.atan2(e,d)*Og,Math.atan2(g,Math.sqrt(d*d+e*e))*Og]}:function(){return[a*Og,b*Og]};return o.distance=m,o}function nc(){function a(a,e){var f=Math.sin(e*=Ng),g=Math.cos(e),h=Math.abs((a*=Ng)-b),i=Math.cos(h);xh+=Math.atan2(Math.sqrt((h=g*Math.sin(h))*h+(h=d*f-c*g*i)*h),c*f+d*g*i),b=a,c=f,d=g}var b,c,d;yh.point=function(e,f){b=e*Ng,c=Math.sin(f*=Ng),d=Math.cos(f),yh.point=a},yh.lineEnd=function(){yh.point=yh.lineEnd=E}}function oc(a){var b=0,c=Lg/3,d=_b(a),e=d(b,c);return e.parallels=function(a){return arguments.length?d(b=a[0]*Lg/180,c=a[1]*Lg/180):[b/Lg*180,c/Lg*180]},e}function pc(a,b){function c(a,b){var c=Math.sqrt(f-2*e*Math.sin(b))/e;return[c*Math.sin(a*=e),g-c*Math.cos(a)]}var d=Math.sin(a),e=(d+Math.sin(b))/2,f=1+d*(2*e-d),g=Math.sqrt(f)/e;return c.invert=function(a,b){var c=g-b;return[Math.atan2(a,c)/e,Math.asin((f-(a*a+c*c)*e*e)/(2*e))]},c}function qc(a,b){var c=a(b[0]),d=a([.5*(b[0][0]+b[1][0]),b[0][1]]),e=a([b[1][0],b[0][1]]),f=a(b[1]),g=d[1]-c[1],h=d[0]-c[0],i=e[1]-d[1],j=e[0]-d[0],k=g/h,l=i/j,m=.5*(k*l*(c[1]-e[1])+l*(c[0]+d[0])-k*(d[0]+e[0]))/(l-k),n=(.5*(c[0]+d[0])-m)/k+.5*(c[1]+d[1]),o=f[0]-m,p=f[1]-n,q=c[0]-m,r=c[1]-n,s=o*o+p*p,t=q*q+r*r,u=Math.atan2(p,o),v=Math.atan2(r,q);return function(b){var c=b[0]-m,d=b[1]-n,e=c*c+d*d,f=Math.atan2(d,c);return e>s&&t>e&&f>u&&v>f?a.invert(b):void 0}}function rc(){function a(a,b){Ah+=e*a-d*b,d=a,e=b}var b,c,d,e;Bh.point=function(f,g){Bh.point=a,b=d=f,c=e=g},Bh.lineEnd=function(){a(b,c)}}function sc(){function a(a,b){g.push("M",a,",",b,f)}function b(a,b){g.push("M",a,",",b),h.point=c}function c(a,b){g.push("L",a,",",b)}function d(){h.point=a}function e(){g.push("Z")}var f=yc(4.5),g=[],h={point:a,lineStart:function(){h.point=b},lineEnd:d,polygonStart:function(){h.lineEnd=e},polygonEnd:function(){h.lineEnd=d,h.point=a},pointRadius:function(a){return f=yc(a),h},result:function(){if(g.length){var a=g.join("");return g=[],a}}};return h}function tc(a,b){ph||(rh+=a,sh+=b,++th)}function uc(){function a(a,d){var e=a-b,f=d-c,g=Math.sqrt(e*e+f*f);rh+=g*(b+a)/2,sh+=g*(c+d)/2,th+=g,b=a,c=d}var b,c;if(1!==ph){if(!(1>ph))return;ph=1,rh=sh=th=0}Ch.point=function(d,e){Ch.point=a,b=d,c=e}}function vc(){Ch.point=tc}function wc(){function a(a,b){var c=e*a-d*b;rh+=c*(d+a),sh+=c*(e+b),th+=3*c,d=a,e=b}var b,c,d,e;2>ph&&(ph=2,rh=sh=th=0),Ch.point=function(f,g){Ch.point=a,b=d=f,c=e=g},Ch.lineEnd=function(){a(b,c)}}function xc(a){function b(b,c){a.moveTo(b,c),a.arc(b,c,g,0,2*Lg)}function c(b,c){a.moveTo(b,c),h.point=d}function d(b,c){a.lineTo(b,c)}function e(){h.point=b}function f(){a.closePath()}var g=4.5,h={point:b,lineStart:function(){h.point=c},lineEnd:e,polygonStart:function(){h.lineEnd=f},polygonEnd:function(){h.lineEnd=e,h.point=b},pointRadius:function(a){return g=a,h},result:E};return h}function yc(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+-2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function zc(a){var b=Zb(function(b,c){return a([b*Og,c*Og])});return function(a){return a=b(a),{point:function(b,c){a.point(b*Ng,c*Ng)},sphere:function(){a.sphere()},lineStart:function(){a.lineStart()},lineEnd:function(){a.lineEnd()},polygonStart:function(){a.polygonStart()},polygonEnd:function(){a.polygonEnd()}}}}function Ac(a,b){function c(b,c){var d=Math.cos(b),e=Math.cos(c),f=a(d*e);return[f*e*Math.sin(b),f*Math.sin(c)]}return c.invert=function(a,c){var d=Math.sqrt(a*a+c*c),e=b(d),f=Math.sin(e),g=Math.cos(e);return[Math.atan2(a*f,d*g),Math.asin(d&&c*f/d)]},c}function Bc(a,b){function c(a,b){var c=Math.abs(Math.abs(b)-Lg/2)1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j9&&(e=3*b/Math.sqrt(e),g[h]=e*c,g[h+1]=e*d)); for(h=-1;++h<=i;)e=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),f.push([e||0,g[h]*e||0]);return f}function _c(a){return a.length<3?Jc(a):a[0]+Qc(a,$c(a))}function ad(a,b,c,d){var e,f,g,h,i,j,k;return e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1],(k-g)*(h-f)-(i-g)*(j-f)>0}function bd(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function cd(a,b,c,d){var e=a[0],f=c[0],g=b[0]-e,h=d[0]-f,i=a[1],j=c[1],k=b[1]-i,l=d[1]-j,m=(h*(i-j)-l*(e-f))/(l*g-h*k);return[e+m*g,i+m*k]}function dd(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.yb.y?1:a.xb.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){var b=d.leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));return b=b.l},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return null==a.edge?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return null==a.edge?c.bottomSite:a.edge.region[Mh[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;return c.c=a.x*d+a.y*e+.5*(d*d+e*e),f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e),c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f,g,h=(c.c*d.b-d.c*c.b)/e,i=(d.c*c.a-c.c*d.a)/e,j=c.region.r,k=d.region.r;j.y=g.region.r.x;return l&&"l"===f.side||!l&&"r"===f.side?null:{x:h,y:i}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&"l"===a.side)return 1;if(!e&&"r"===a.side)return 0;if(1===c.a){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;if(!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1)),!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)m*m+n*n}return"l"===a.side?i:!i},endPoint:function(a,c,d){a.ep[c]=d,a.ep[Mh[c]]&&b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;g>d;d++){var h=e[d];if(!(a.ystar>h.ystar||a.ystar==h.ystar&&b.x>h.vertex.x))break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;d>b&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return 0===f.list.length},nextEvent:function(a){for(var b=0,c=f.list,d=c.length;d>b;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=f.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return f.list.shift()}};d.init(),c.bottomSite=c.list.shift();for(var g,h,i,j,k,l,m,n,o,p,q,r,s,t=c.list.shift();;)if(f.empty()||(g=f.min()),t&&(f.empty()||t.yn.y&&(o=m,m=n,n=o,s="r"),r=e.bisect(m,n),l=d.createHalfEdge(r,s),d.insert(j,l),e.endPoint(r,Mh[s],q),p=e.intersect(j,l),p&&(f.del(j),f.insert(j,p,e.distance(p,m))),p=e.intersect(l,k),p&&f.insert(l,p,e.distance(p,m))}for(h=d.right(d.leftEnd);h!=d.rightEnd;h=d.right(h))b(h.edge)}function ed(a){return a.x}function fd(a){return a.y}function gd(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function hd(a,b,c,d,e,f){if(!a(b,c,d,e,f)){var g=.5*(c+e),h=.5*(d+f),i=b.nodes;i[0]&&hd(a,i[0],c,d,g,h),i[1]&&hd(a,i[1],g,d,e,h),i[2]&&hd(a,i[2],c,h,g,f),i[3]&&hd(a,i[3],g,h,e,f)}}function id(a,b){a=jg.rgb(a),b=jg.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+eb(Math.round(c+f*a))+eb(Math.round(d+g*a))+eb(Math.round(e+h*a))}}function jd(a){var b=[a.a,a.b],c=[a.c,a.d],d=ld(b),e=kd(b,c),f=ld(md(c,b,-e))||0;b[0]*c[1]180?k+=360:k-j>180&&(j+=360),e.push({i:d.push(d.pop()+"rotate(",null,")")-2,x:nd(j,k)})):k&&d.push(d.pop()+"rotate("+k+")"),l!=m?e.push({i:d.push(d.pop()+"skewX(",null,")")-2,x:nd(l,m)}):m&&d.push(d.pop()+"skewX("+m+")"),n[0]!=o[0]||n[1]!=o[1]?(c=d.push(d.pop()+"scale(",null,",",null,")"),e.push({i:c-4,x:nd(n[0],o[0])},{i:c-2,x:nd(n[1],o[1])})):(1!=o[0]||1!=o[1])&&d.push(d.pop()+"scale("+o+")"),c=e.length,function(a){for(var b,f=-1;++fd;++d)if(g=k[d],g.x==c[0]){if(g.i)if(null==j[g.i+1])for(j[g.i-1]+=g.x,j.splice(g.i,1),e=d+1;f>e;++e)k[e].i--;else for(j[g.i-1]+=g.x+j[g.i+1],j.splice(g.i,2),e=d+1;f>e;++e)k[e].i-=2;else if(null==j[g.i+1])j[g.i]=g.x;else for(j[g.i]=g.x+j[g.i+1],j.splice(g.i+1,1),e=d+1;f>e;++e)k[e].i--;k.splice(d,1),f--,d--}else g.x=nd(parseFloat(c[0]),parseFloat(g.x));for(;f>d;)g=k.pop(),null==j[g.i+1]?j[g.i]=g.x:(j[g.i]=g.x+j[g.i+1],j.splice(g.i+1,1)),f--;return 1===j.length?null==j[0]?k[0].x:function(){return b}:function(a){for(d=0;f>d;++d)j[(g=k[d]).i]=g.x(a);return j.join("")}}function rd(a,b){for(var c,d=jg.interpolators.length;--d>=0&&!(c=jg.interpolators[d](a,b)););return c}function sd(a){return"transform"==a?od:rd}function td(a,b){var c,d=[],e=[],f=a.length,g=b.length,h=Math.min(a.length,b.length);for(c=0;h>c;++c)d.push(rd(a[c],b[c]));for(;f>c;++c)e[c]=a[c];for(;g>c;++c)e[c]=b[c];return function(a){for(c=0;h>c;++c)e[c]=d[c](a);return e}}function ud(a){return function(b){return 0>=b?0:b>=1?1:a(b)}}function vd(a){return function(b){return 1-a(1-b)}}function wd(a){return function(b){return.5*(.5>b?a(2*b):2-a(2-2*b))}}function xd(a){return a*a}function yd(a){return a*a*a}function zd(a){if(0>=a)return 0;if(a>=1)return 1;var b=a*a,c=b*a;return 4*(.5>a?c:3*(a-b)+c-.75)}function Ad(a){return function(b){return Math.pow(b,a)}}function Bd(a){return 1-Math.cos(a*Lg/2)}function Cd(a){return Math.pow(2,10*(a-1))}function Dd(a){return 1-Math.sqrt(1-a*a)}function Ed(a,b){var c;return arguments.length<2&&(b=.45),arguments.length?c=b/(2*Lg)*Math.asin(1/a):(a=1,c=b/4),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin(2*(d-c)*Lg/b)}}function Fd(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function Gd(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function Hd(a,b){a=jg.hcl(a),b=jg.hcl(b);var c=a.h,d=a.c,e=a.l,f=b.h-c,g=b.c-d,h=b.l-e;return f>180?f-=360:-180>f&&(f+=360),function(a){return W(c+f*a,d+g*a,e+h*a)+""}}function Id(a,b){a=jg.hsl(a),b=jg.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return f>180?f-=360:-180>f&&(f+=360),function(a){return N(c+f*a,d+g*a,e+h*a)+""}}function Jd(a,b){a=jg.lab(a),b=jg.lab(b);var c=a.l,d=a.a,e=a.b,f=b.l-c,g=b.a-d,h=b.b-e;return function(a){return Z(c+f*a,d+g*a,e+h*a)+""}}function Kd(a,b){return b-=a,function(c){return Math.round(a+b*c)}}function Ld(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function Md(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function Nd(a){for(var b=a.source,c=a.target,d=Pd(b,c),e=[b];b!==d;)b=b.parent,e.push(b);for(var f=e.length;c!==d;)e.splice(f,0,c),c=c.parent;return e}function Od(a){for(var b=[],c=a.parent;null!=c;)b.push(a),a=c,c=c.parent;return b.push(a),b}function Pd(a,b){if(a===b)return a;for(var c=Od(a),d=Od(b),e=c.pop(),f=d.pop(),g=null;e===f;)g=e,e=c.pop(),f=d.pop();return g}function Qd(a){a.fixed|=2}function Rd(a){a.fixed&=-7}function Sd(a){a.fixed|=4,a.px=a.x,a.py=a.y}function Td(a){a.fixed&=-5}function Ud(a,b,c){var d=0,e=0;if(a.charge=0,!a.leaf)for(var f,g=a.nodes,h=g.length,i=-1;++ic;++c)(b=a[c][1])>e&&(d=c,e=b);return d}function ee(a){return a.reduce(fe,0)}function fe(a,b){return a+b[1]}function ge(a,b){return he(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function he(a,b){for(var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];++c<=b;)f[c]=e*c+d;return f}function ie(a){return[jg.min(a),jg.max(a)]}function je(a,b){return a.parent==b.parent?1:2}function ke(a){var b=a.children;return b&&b.length?b[0]:a._tree.thread}function le(a){var b,c=a.children;return c&&(b=c.length)?c[b-1]:a._tree.thread}function me(a,b){var c=a.children;if(c&&(e=c.length))for(var d,e,f=-1;++f0&&(a=d);return a}function ne(a,b){return a.x-b.x}function oe(a,b){return b.x-a.x}function pe(a,b){return a.depth-b.depth}function qe(a,b){function c(a,d){var e=a.children;if(e&&(g=e.length))for(var f,g,h=null,i=-1;++i=0;)b=e[f]._tree,b.prelim+=c,b.mod+=c,c+=b.shift+(d+=b.change)}function se(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function te(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function ue(a,b){return a.value-b.value}function ve(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function we(a,b){a._pack_next=b,b._pack_prev=a}function xe(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function ye(a){function b(a){k=Math.min(a.x-a.r,k),l=Math.max(a.x+a.r,l),m=Math.min(a.y-a.r,m),n=Math.max(a.y+a.r,n)}if((c=a.children)&&(j=c.length)){var c,d,e,f,g,h,i,j,k=1/0,l=-1/0,m=1/0,n=-1/0;if(c.forEach(ze),d=c[0],d.x=-d.r,d.y=0,b(d),j>1&&(e=c[1],e.x=e.r,e.y=0,b(e),j>2))for(f=c[2],Ce(d,e,f),b(f),ve(d,f),d._pack_prev=f,ve(f,e),e=d._pack_next,g=3;j>g;g++){Ce(d,e,f=c[g]);var o=0,p=1,q=1;for(h=e._pack_next;h!==e;h=h._pack_next,p++)if(xe(h,f)){o=1;break}if(1==o)for(i=d._pack_prev;i!==h._pack_prev&&!xe(i,f);i=i._pack_prev,q++);o?(q>p||p==q&&e.rg;g++)f=c[g],f.x-=r,f.y-=s,t=Math.max(t,f.r+Math.sqrt(f.x*f.x+f.y*f.y));a.r=t,c.forEach(Ae)}}function ze(a){a._pack_next=a._pack_prev=a}function Ae(a){delete a._pack_next,delete a._pack_prev}function Be(a,b,c,d){var e=a.children;if(a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d,e)for(var f=-1,g=e.length;++fe&&(c+=e/2,e=0),0>f&&(d+=f/2,f=0),{x:c,y:d,dx:e,dy:f}}function Je(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function Ke(a){return a.rangeExtent?a.rangeExtent():Je(a.range())}function Le(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function Me(a,b){var c,d=0,e=a.length-1,f=a[d],g=a[e];return f>g&&(c=d,d=e,e=c,c=f,f=g,g=c),(b=b(g-f))&&(a[d]=b.floor(f),a[e]=b.ceil(g)),a}function Ne(a,b,c,d){var e=[],f=[],g=0,h=Math.min(a.length,b.length)-1;for(a[h]2?Ne:Le,i=d?Md:Ld;return g=e(a,b,i,c),h=e(b,a,i,rd),f}function f(a){return g(a)}var g,h;return f.invert=function(a){return h(a)},f.domain=function(b){return arguments.length?(a=b.map(Number),e()):a},f.range=function(a){return arguments.length?(b=a,e()):b},f.rangeRound=function(a){return f.range(a).interpolate(Kd)},f.clamp=function(a){return arguments.length?(d=a,e()):d},f.interpolate=function(a){return arguments.length?(c=a,e()):c},f.ticks=function(b){return Se(a,b)},f.tickFormat=function(b,c){return Te(a,b,c)},f.nice=function(){return Me(a,Qe),e()},f.copy=function(){return Oe(a,b,c,d)},e()}function Pe(a,b){return jg.rebind(a,b,"range","rangeRound","interpolate","clamp")}function Qe(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),a&&{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function Re(a,b){var c=Je(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return.15>=f?e*=10:.35>=f?e*=5:.75>=f&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+.5*e,c[2]=e,c}function Se(a,b){return jg.range.apply(jg,Re(a,b))}function Te(a,b,c){var d=-Math.floor(Math.log(Re(a,b)[2])/Math.LN10+.01);return jg.format(c?c.replace(fh,function(a,b,c,e,f,g,h,i,j,k){return[b,c,e,f,g,h,i,j||"."+(d-2*("%"===k)),k].join("")}):",."+d+"f")}function Ue(a,b,c,d){function e(b){return a(c(b))}return e.invert=function(b){return d(a.invert(b))},e.domain=function(b){return arguments.length?(b[0]<0?(c=Xe,d=Ye):(c=Ve,d=We),a.domain(b.map(c)),e):a.domain().map(d)},e.base=function(a){return arguments.length?(b=+a,e):b},e.nice=function(){return a.domain(Me(a.domain(),Ze(b))),e},e.ticks=function(){var e=Je(a.domain()),f=[];if(e.every(isFinite)){var g=Math.log(b),h=Math.floor(e[0]/g),i=Math.ceil(e[1]/g),j=d(e[0]),k=d(e[1]),l=b%1?2:b;if(c===Xe)for(f.push(-Math.pow(b,-h));h++0;m--)f.push(-Math.pow(b,-h)*m);else{for(;i>h;h++)for(var m=1;l>m;m++)f.push(Math.pow(b,h)*m);f.push(Math.pow(b,h))}for(h=0;f[h]k;i--);f=f.slice(h,i)}return f},e.tickFormat=function(a,f){if(arguments.length<2&&(f=Xh),!arguments.length)return f;var g,h=Math.log(b),i=Math.max(.1,a/e.ticks().length),j=c===Xe?(g=-1e-12,Math.floor):(g=1e-12,Math.ceil);return function(a){return a/d(h*j(c(a)/h+g))<=i?f(a):""}},e.copy=function(){return Ue(a.copy(),b,c,d)},Pe(e,a)}function Ve(a){return Math.log(0>a?0:a)}function We(a){return Math.exp(a)}function Xe(a){return-Math.log(a>0?0:-a)}function Ye(a){return-Math.exp(-a)}function Ze(a){a=Math.log(a);var b={floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}};return function(){return b}}function $e(a,b){function c(b){return a(d(b))}var d=_e(b),e=_e(1/b);return c.invert=function(b){return e(a.invert(b))},c.domain=function(b){return arguments.length?(a.domain(b.map(d)),c):a.domain().map(e)},c.ticks=function(a){return Se(c.domain(),a)},c.tickFormat=function(a,b){return Te(c.domain(),a,b)},c.nice=function(){return c.domain(Me(c.domain(),Qe))},c.exponent=function(a){if(!arguments.length)return b;var f=c.domain();return d=_e(b=a),e=_e(1/b),c.domain(f)},c.copy=function(){return $e(a.copy(),b)},Pe(c,a)}function _e(a){return function(b){return 0>b?-Math.pow(-b,a):Math.pow(b,a)}}function af(a,b){function c(b){return g[((e.get(b)||e.set(b,a.push(b)))-1)%g.length]}function d(b,c){return jg.range(a.length).map(function(a){return b+c*a})}var e,g,h;return c.domain=function(d){if(!arguments.length)return a;a=[],e=new f;for(var g,h=-1,i=d.length;++hc?j():(e.active=c,m.start.call(a,k,b),g.tween.forEach(function(c,d){(d=d.call(a,k,b))&&p.push(d)}),i(d)||jg.timer(i,0,h),1)}function i(d){if(e.active!==c)return j();for(var f=(d-n)/o,g=l(f),h=p.length;h>0;)p[--h].call(a,g);return f>=1?(j(),m.end.call(a,k,b),1):void 0}function j(){return--e.count?delete e[c]:delete a.__transition__,1}var k=a.__data__,l=g.ease,m=g.event,n=g.delay,o=g.duration,p=[];return d>=n?f(d):jg.timer(f,n,h),1},0,h),g}}function wf(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function xf(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function yf(a,b,c){if(d=[],c&&b.length>1){for(var d,e,f,g=Je(a.domain()),h=-1,i=b.length,j=(b[1]-b[0])/++c;++h0;)(f=+b[h]-e*j)>=g[0]&&d.push(f);for(--h,e=0;++e1?Date.UTC.apply(this,arguments):arguments[0])}function Af(a,b,c){function d(b){var c=a(b),d=f(c,1);return d-b>b-c?c:d}function e(c){return b(c=a(new ni(c-1)),1),c}function f(a,c){return b(a=new ni(+a),c),a}function g(a,d,f){var g=e(a),h=[];if(f>1)for(;d>g;)c(g)%f||h.push(new Date(+g)),b(g,1);else for(;d>g;)h.push(new Date(+g)),b(g,1);return h}function h(a,b,c){try{ni=zf;var d=new zf;return d._=a,g(d,b,c)}finally{ni=Date}}a.floor=a,a.round=d,a.ceil=e,a.offset=f,a.range=g;var i=a.utc=Bf(a);return i.floor=i,i.round=Bf(d),i.ceil=Bf(e),i.offset=Bf(f),i.range=h,a}function Bf(a){return function(b,c){try{ni=zf;var d=new zf;return d._=b,a(d,c)._}finally{ni=Date}}}function Cf(a,b,c,d){for(var e,f,g=0,h=b.length,i=c.length;h>g;){if(d>=i)return-1;if(e=b.charCodeAt(g++),37===e){if(f=Fi[b.charAt(g++)],!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function Df(a){return new RegExp("^(?:"+a.map(jg.requote).join("|")+")","i")}function Ef(a){for(var b=new f,c=-1,d=a.length;++cd?new Array(c-d+1).join(b)+a:a}function Gf(a,b,c){yi.lastIndex=0;var d=yi.exec(b.substring(c));return d?c+=d[0].length:-1}function Hf(a,b,c){xi.lastIndex=0;var d=xi.exec(b.substring(c));return d?c+=d[0].length:-1}function If(a,b,c){Bi.lastIndex=0;var d=Bi.exec(b.substring(c));return d?(a.m=Ci.get(d[0].toLowerCase()),c+=d[0].length):-1}function Jf(a,b,c){zi.lastIndex=0;var d=zi.exec(b.substring(c));return d?(a.m=Ai.get(d[0].toLowerCase()),c+=d[0].length):-1}function Kf(a,b,c){return Cf(a,Ei.c.toString(),b,c)}function Lf(a,b,c){return Cf(a,Ei.x.toString(),b,c)}function Mf(a,b,c){return Cf(a,Ei.X.toString(),b,c)}function Nf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+4));return d?(a.y=+d[0],c+=d[0].length):-1}function Of(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+2));return d?(a.y=Pf(+d[0]),c+=d[0].length):-1}function Pf(a){return a+(a>68?1900:2e3)}function Qf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+2));return d?(a.m=d[0]-1,c+=d[0].length):-1}function Rf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+2));return d?(a.d=+d[0],c+=d[0].length):-1}function Sf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+2));return d?(a.H=+d[0],c+=d[0].length):-1}function Tf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+2));return d?(a.M=+d[0],c+=d[0].length):-1}function Uf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+2));return d?(a.S=+d[0],c+=d[0].length):-1}function Vf(a,b,c){Gi.lastIndex=0;var d=Gi.exec(b.substring(c,c+3));return d?(a.L=+d[0],c+=d[0].length):-1}function Wf(a,b,c){var d=Hi.get(b.substring(c,c+=2).toLowerCase());return null==d?-1:(a.p=d,c)}function Xf(a){var b=a.getTimezoneOffset(),c=b>0?"-":"+",d=~~(Math.abs(b)/60),e=Math.abs(b)%60;return c+Ff(d,"0",2)+Ff(e,"0",2)}function Yf(a){return a.toISOString()}function Zf(a,b,c){function d(b){return a(b)}return d.invert=function(b){return _f(a.invert(b))},d.domain=function(b){return arguments.length?(a.domain(b),d):a.domain().map(_f)},d.nice=function(a){return d.domain(Me(d.domain(),function(){return a}))},d.ticks=function(c,e){var f=$f(d.domain());if("function"!=typeof c){var g=f[1]-f[0],h=g/c,i=jg.bisect(Ji,h);if(i==Ji.length)return b.year(f,c);if(!i)return a.ticks(c).map(_f);Math.log(h/Ji[i-1])b?[b,c]:[c,b]}function _f(a){return new Date(a)}function ag(a){return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}function bg(a){var b=new Date(a,0,1);return b.setFullYear(a),b}function cg(a){var b=a.getFullYear(),c=bg(b),d=bg(b+1);return b+(a-c)/(d-c)}function dg(a){var b=new Date(Date.UTC(a,0,1));return b.setUTCFullYear(a),b}function eg(a){var b=a.getUTCFullYear(),c=dg(b),d=dg(b+1);return b+(a-c)/(d-c)}function fg(a){return a.responseText}function gg(a){return JSON.parse(a.responseText)}function hg(a){var b=kg.createRange();return b.selectNode(kg.body),b.createContextualFragment(a.responseText)}function ig(a){return a.responseXML}var jg={version:"3.1.5"};Date.now||(Date.now=function(){return+new Date});var kg=document,lg=window;try{kg.createElement("div").style.setProperty("opacity",0,"")}catch(mg){var ng=lg.CSSStyleDeclaration.prototype,og=ng.setProperty;ng.setProperty=function(a,b,c){og.call(this,a,b+"",c)}}jg.ascending=function(a,b){return b>a?-1:a>b?1:a>=b?0:0/0},jg.descending=function(a,b){return a>b?-1:b>a?1:b>=a?0:0/0},jg.min=function(a,b){var c,d,e=-1,f=a.length;if(1===arguments.length){for(;++ed&&(c=d)}else{for(;++ed&&(c=d)}return c},jg.max=function(a,b){var c,d,e=-1,f=a.length;if(1===arguments.length){for(;++ec&&(c=d)}else{for(;++ec&&(c=d)}return c},jg.extent=function(a,b){var c,d,e,f=-1,g=a.length;if(1===arguments.length){for(;++fd&&(c=d),d>e&&(e=d))}else{for(;++fd&&(c=d),d>e&&(e=d))}return[c,e]},jg.sum=function(a,b){var c,d=0,e=a.length,f=-1;if(1===arguments.length)for(;++f1&&(b=b.map(c)),b=b.filter(a),b.length?jg.quantile(b.sort(jg.ascending),.5):void 0},jg.bisector=function(a){return{left:function(b,c,d,e){for(arguments.length<3&&(d=0),arguments.length<4&&(e=b.length);e>d;){var f=d+e>>>1;a.call(b,b[f],f)d;){var f=d+e>>>1;cc)for(;(e=a+c*++h)>b;)f.push(e/g);else for(;(e=a+c*++h)=g.length)return d?d.call(e,h):c?h.sort(c):h;for(var j,k,l,m,n=-1,o=h.length,p=g[i++],q=new f;++n=g.length)return a;var d=[],e=h[c++];return a.forEach(function(a,e){d.push({key:a,values:b(e,c)})}),e?d.sort(function(a,b){return e(a.key,b.key)}):d}var c,d,e={},g=[],h=[];return e.map=function(b,c){return a(c,b,0)},e.entries=function(c){return b(a(jg.map,c,0),0)},e.key=function(a){return g.push(a),e},e.sortKeys=function(a){return h[g.length-1]=a,e},e.sortValues=function(a){return c=a,e},e.rollup=function(a){return d=a,e},e},jg.set=function(a){var b=new g;if(a)for(var c=0;c=0&&(d=a.substring(c+1),a=a.substring(0,c)),a)return arguments.length<2?this[a].on(d):this[a].on(d,b);if(2===arguments.length){if(null==b)for(a in this)this.hasOwnProperty(a)&&this[a].on(d,null);return this}},jg.event=null,jg.mouse=function(a){return o(a,l())};var sg=/WebKit/.test(lg.navigator.userAgent)?-1:0,tg=q;try{tg(kg.documentElement.childNodes)[0].nodeType}catch(ug){tg=p}var vg=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};jg.touches=function(a,b){return arguments.length<2&&(b=l().touches),b?tg(b).map(function(b){var c=o(a,b);return c.identifier=b.identifier,c}):[]},jg.behavior.drag=function(){function a(){this.on("mousedown.drag",b).on("touchstart.drag",b)}function b(){function a(){var a=g.parentNode;return null!=j?jg.touches(a).filter(function(a){return a.identifier===j})[0]:jg.mouse(a)}function b(){if(!g.parentNode)return e();var b=a(),c=b[0]-l[0],d=b[1]-l[1];n|=c|d,l=b,k(),h({type:"drag",x:b[0]+f[0],y:b[1]+f[1],dx:c,dy:d})}function e(){h({type:"dragend"}),n&&(k(),jg.event.target===i&&m(o,"click")),o.on(null!=j?"touchmove.drag-"+j:"mousemove.drag",null).on(null!=j?"touchend.drag-"+j:"mouseup.drag",null)}var f,g=this,h=c.of(g,arguments),i=jg.event.target,j=jg.event.touches?jg.event.changedTouches[0].identifier:null,l=a(),n=0,o=jg.select(lg).on(null!=j?"touchmove.drag-"+j:"mousemove.drag",b).on(null!=j?"touchend.drag-"+j:"mouseup.drag",e,!0);d?(f=d.apply(g,arguments),f=[f.x-l[0],f.y-l[1]]):f=[0,0],null==j&&k(),h({type:"dragstart"})}var c=n(a,"drag","dragstart","dragend"),d=null;return a.origin=function(b){return arguments.length?(d=b,a):d},jg.rebind(a,c,"on")};var wg=function(a,b){return b.querySelector(a)},xg=function(a,b){return b.querySelectorAll(a)},yg=kg.documentElement,zg=yg.matchesSelector||yg.webkitMatchesSelector||yg.mozMatchesSelector||yg.msMatchesSelector||yg.oMatchesSelector,Ag=function(a,b){return zg.call(a,b)};"function"==typeof Sizzle&&(wg=function(a,b){return Sizzle(a,b)[0]||null},xg=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},Ag=Sizzle.matchesSelector);var Bg=[];jg.selection=function(){return Gg},jg.selection.prototype=Bg,Bg.select=function(a){var b,c,d,e,f=[];"function"!=typeof a&&(a=s(a));for(var g=-1,h=this.length;++g=0&&(c=a.substring(0,b),a=a.substring(b+1)),Cg.hasOwnProperty(c)?{space:Cg[c],local:a}:a}},Bg.attr=function(a,b){if(arguments.length<2){if("string"==typeof a){var c=this.node();return a=jg.ns.qualify(a),a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}for(b in a)this.each(u(b,a[b]));return this}return this.each(u(a,b))},jg.requote=function(a){return a.replace(Dg,"\\$&")};var Dg=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Bg.classed=function(a,b){if(arguments.length<2){if("string"==typeof a){var c=this.node(),d=(a=a.trim().split(/^|\s+/g)).length,e=-1;if(b=c.classList){for(;++ed){if("string"!=typeof a){2>d&&(b="");for(c in a)this.each(z(c,a[c],b));return this}if(2>d)return lg.getComputedStyle(this.node(),null).getPropertyValue(a);c=""}return this.each(z(a,b,c))},Bg.property=function(a,b){if(arguments.length<2){if("string"==typeof a)return this.node()[a];for(b in a)this.each(A(b,a[b]));return this}return this.each(A(a,b))},Bg.text=function(a){return arguments.length?this.each("function"==typeof a?function(){var b=a.apply(this,arguments);this.textContent=null==b?"":b}:null==a?function(){this.textContent=""}:function(){this.textContent=a}):this.node().textContent},Bg.html=function(a){return arguments.length?this.each("function"==typeof a?function(){var b=a.apply(this,arguments);this.innerHTML=null==b?"":b}:null==a?function(){this.innerHTML=""}:function(){this.innerHTML=a}):this.node().innerHTML},Bg.append=function(a){function b(){return this.appendChild(kg.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(kg.createElementNS(a.space,a.local))}return a=jg.ns.qualify(a),this.select(a.local?c:b)},Bg.insert=function(a,b){function c(c,d){return this.insertBefore(kg.createElementNS(this.namespaceURI,a),b.call(this,c,d))}function d(c,d){return this.insertBefore(kg.createElementNS(a.space,a.local),b.call(this,c,d))}return a=jg.ns.qualify(a),"function"!=typeof b&&(b=s(b)),this.select(a.local?d:c)},Bg.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},Bg.data=function(a,b){function c(a,c){var d,e,g,h=a.length,l=c.length,m=Math.min(h,l),n=new Array(l),o=new Array(l),p=new Array(h);if(b){var q,r=new f,s=new f,t=[];for(d=-1;++dd;++d)o[d]=B(c[d]);for(;h>d;++d)p[d]=a[d]}o.update=n,o.parentNode=n.parentNode=p.parentNode=a.parentNode,i.push(o),j.push(n),k.push(p)}var d,e,g=-1,h=this.length;if(!arguments.length){for(a=new Array(h=(d=this[0]).length);++gf;f++){e.push(b=[]),b.parentNode=(c=this[f]).parentNode;for(var h=0,i=c.length;i>h;h++)(d=c[h])&&a.call(d,d.__data__,h)&&b.push(d)}return r(e)},Bg.order=function(){for(var a=-1,b=this.length;++a=0;)(c=d[e])&&(f&&f!==c.nextSibling&&f.parentNode.insertBefore(c,f),f=c);return this},Bg.sort=function(a){a=D.apply(this,arguments);for(var b=-1,c=this.length;++bd){if("string"!=typeof a){2>d&&(b=!1);for(c in a)this.each(F(c,a[c],b));return this}if(2>d)return(d=this.node()["__on"+a])&&d._;c=!1}return this.each(F(a,b,c))};var Eg=jg.map({mouseenter:"mouseover",mouseleave:"mouseout"});Eg.forEach(function(a){"on"+a in kg&&Eg.remove(a)}),Bg.each=function(a){return I(this,function(b,c,d){a.call(b,b.__data__,c,d)})},Bg.call=function(a){var b=tg(arguments);return a.apply(b[0]=this,b),this},Bg.empty=function(){return!this.node()},Bg.node=function(){for(var a=0,b=this.length;b>a;a++)for(var c=this[a],d=0,e=c.length;e>d;d++){var f=c[d];if(f)return f}return null};var Fg=[];jg.selection.enter=J,jg.selection.enter.prototype=Fg,Fg.append=Bg.append,Fg.insert=Bg.insert,Fg.empty=Bg.empty,Fg.node=Bg.node,Fg.select=function(a){for(var b,c,d,e,f,g=[],h=-1,i=this.length;++hc-w){var f=a[0],h=b(a[0]);d(2*y),e(f,h),g(A.of(this,arguments))}w=c}}function p(){var a=jg.touches(this),b=a[0],c=q[b.identifier];if(f=a[1]){var f,h=q[f.identifier];b=[(b[0]+f[0])/2,(b[1]+f[1])/2],c=[(c[0]+h[0])/2,(c[1]+h[1])/2],d(jg.event.scale*r)}e(b,c),w=null,g(A.of(this,arguments))}var q,r,s,t,u,v,w,x=[0,0],y=1,z=Ig,A=n(a,"zoom");return a.translate=function(b){return arguments.length?(x=b.map(Number),f(),a):x},a.scale=function(b){return arguments.length?(y=+b,f(),a):y},a.scaleExtent=function(b){return arguments.length?(z=null==b?Ig:b.map(Number),a):z},a.x=function(b){return arguments.length?(t=b,s=b.copy(),x=[0,0],y=1,a):t},a.y=function(b){return arguments.length?(v=b,u=b.copy(),x=[0,0],y=1,a):v},jg.rebind(a,A,"on")};var Hg,Ig=[0,1/0],Jg="onwheel"in kg?(Hg=function(){return-jg.event.deltaY*(jg.event.deltaMode?120:1)},"wheel"):"onmousewheel"in kg?(Hg=function(){return jg.event.wheelDelta},"mousewheel"):(Hg=function(){return-jg.event.detail},"MozMousePixelScroll");K.prototype.toString=function(){return this.rgb()+""},jg.hsl=function(a,b,c){return 1===arguments.length?a instanceof M?L(a.h,a.s,a.l):fb(""+a,gb,L):L(+a,+b,+c)};var Kg=M.prototype=new K;Kg.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),L(this.h,this.s,this.l/a)},Kg.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),L(this.h,this.s,a*this.l)},Kg.rgb=function(){return N(this.h,this.s,this.l)};var Lg=Math.PI,Mg=1e-6,Ng=Lg/180,Og=180/Lg;jg.hcl=function(a,b,c){return 1===arguments.length?a instanceof V?U(a.h,a.c,a.l):a instanceof Y?$(a.l,a.a,a.b):$((a=hb((a=jg.rgb(a)).r,a.g,a.b)).l,a.a,a.b):U(+a,+b,+c)};var Pg=V.prototype=new K;Pg.brighter=function(a){return U(this.h,this.c,Math.min(100,this.l+Qg*(arguments.length?a:1)))},Pg.darker=function(a){return U(this.h,this.c,Math.max(0,this.l-Qg*(arguments.length?a:1)))},Pg.rgb=function(){return W(this.h,this.c,this.l).rgb()},jg.lab=function(a,b,c){return 1===arguments.length?a instanceof Y?X(a.l,a.a,a.b):a instanceof V?W(a.l,a.c,a.h):hb((a=jg.rgb(a)).r,a.g,a.b):X(+a,+b,+c)};var Qg=18,Rg=.95047,Sg=1,Tg=1.08883,Ug=Y.prototype=new K;Ug.brighter=function(a){return X(Math.min(100,this.l+Qg*(arguments.length?a:1)),this.a,this.b)},Ug.darker=function(a){return X(Math.max(0,this.l-Qg*(arguments.length?a:1)),this.a,this.b)},Ug.rgb=function(){return Z(this.l,this.a,this.b)},jg.rgb=function(a,b,c){return 1===arguments.length?a instanceof db?cb(a.r,a.g,a.b):fb(""+a,cb,N):cb(~~a,~~b,~~c)};var Vg=db.prototype=new K;Vg.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return b||c||d?(b&&e>b&&(b=e),c&&e>c&&(c=e),d&&e>d&&(d=e),cb(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))):cb(e,e,e)},Vg.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),cb(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},Vg.hsl=function(){return gb(this.r,this.g,this.b)},Vg.toString=function(){return"#"+eb(this.r)+eb(this.g)+eb(this.b)};var Wg=jg.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Wg.forEach(function(a,b){Wg.set(a,fb(b,cb,N))}),jg.functor=kb,jg.xhr=function(a,b,c){function d(){var a=i.status;!a&&i.responseText||a>=200&&300>a||304===a?f.load.call(e,h.call(e,i)):f.error.call(e,i)}var e={},f=jg.dispatch("progress","load","error"),g={},h=lb,i=new(lg.XDomainRequest&&/^(http(s)?:)?\/\//.test(a)?XDomainRequest:XMLHttpRequest);return"onload"in i?i.onload=i.onerror=d:i.onreadystatechange=function(){i.readyState>3&&d()},i.onprogress=function(a){var b=jg.event;jg.event=a;try{f.progress.call(e,i)}finally{jg.event=b}},e.header=function(a,b){return a=(a+"").toLowerCase(),arguments.length<2?g[a]:(null==b?delete g[a]:g[a]=b+"",e)},e.mimeType=function(a){return arguments.length?(b=null==a?null:a+"",e):b},e.response=function(a){return h=a,e},["get","post"].forEach(function(a){e[a]=function(){return e.send.apply(e,[a].concat(tg(arguments)))}}),e.send=function(c,d,f){if(2===arguments.length&&"function"==typeof d&&(f=d,d=null),i.open(c,a,!0),null==b||"accept"in g||(g.accept=b+",*/*"),i.setRequestHeader)for(var h in g)i.setRequestHeader(h,g[h]);return null!=b&&i.overrideMimeType&&i.overrideMimeType(b),null!=f&&e.on("error",f).on("load",function(a){f(null,a)}),i.send(null==d?null:d),e},e.abort=function(){return i.abort(),e},jg.rebind(e,f,"on"),2===arguments.length&&"function"==typeof b&&(c=b,b=null),null==c?e:e.get(mb(c))},jg.csv=nb(",","text/csv"),jg.tsv=nb(" ","text/tab-separated-values");var Xg,Yg,Zg=0,$g={},_g=null;jg.timer=function(a,b,c){if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}var d=$g[a.id];d&&d.callback===a?(d.then=c,d.delay=b):$g[a.id=++Zg]=_g={callback:a,then:c,delay:b,next:_g},Xg||(Yg=clearTimeout(Yg),Xg=1,ah(ob))},jg.timer.flush=function(){for(var a,b=Date.now(),c=_g;c;)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;pb()};var ah=lg.requestAnimationFrame||lg.webkitRequestAnimationFrame||lg.mozRequestAnimationFrame||lg.oRequestAnimationFrame||lg.msRequestAnimationFrame||function(a){setTimeout(a,17)},bh=".",ch=",",dh=[3,3],eh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(qb);jg.formatPrefix=function(a,b){var c=0;return a&&(0>a&&(a*=-1),b&&(a=jg.round(a,rb(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,3*Math.floor((0>=c?c+1:c-1)/3)))),eh[8+c/3]},jg.round=function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},jg.format=function(a){var b=fh.exec(a),c=b[1]||" ",d=b[2]||">",e=b[3]||"",f=b[4]||"",g=b[5],h=+b[6],i=b[7],j=b[8],k=b[9],l=1,m="",n=!1;switch(j&&(j=+j.substring(1)),(g||"0"===c&&"="===d)&&(g=c="0",d="=",i&&(h-=Math.floor((h-1)/4))),k){case"n":i=!0,k="g";break;case"%":l=100,m="%",k="f";break;case"p":l=100,m="%",k="r";break;case"b":case"o":case"x":case"X":f&&(f="0"+k.toLowerCase());case"c":case"d":n=!0,j=0;break;case"s":l=-1,k="r"}"#"===f&&(f=""),"r"!=k||j||(k="g"),null!=j&&("g"==k?j=Math.max(1,Math.min(21,j)):("e"==k||"f"==k)&&(j=Math.max(0,Math.min(20,j)))),k=gh.get(k)||sb;var o=g&&i;return function(a){if(n&&a%1)return"";var b=0>a||0===a&&0>1/a?(a=-a,"-"):e;if(0>l){var p=jg.formatPrefix(a,j);a=p.scale(a),m=p.symbol}else a*=l;a=k(a,j),!g&&i&&(a=hh(a));var q=f.length+a.length+(o?0:b.length),r=h>q?new Array(q=h-q+1).join(c):"";return o&&(a=hh(r+a)),bh&&a.replace(".",bh),b+=f,("<"===d?b+a+r:">"===d?r+b+a:"^"===d?r.substring(0,q>>=1)+b+a+r.substring(q):b+(o?a:r+a))+m}};var fh=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,gh=jg.map({b:function(a){return a.toString(2)},c:function(a){return String.fromCharCode(a)},o:function(a){return a.toString(8)},x:function(a){return a.toString(16)},X:function(a){return a.toString(16).toUpperCase()},g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return(a=jg.round(a,rb(a,b))).toFixed(Math.max(0,Math.min(20,rb(a*(1+1e-15),b))))}}),hh=lb;if(dh){var ih=dh.length;hh=function(a){for(var b=a.lastIndexOf("."),c=b>=0?"."+a.substring(b+1):(b=a.length,""),d=[],e=0,f=dh[0];b>0&&f>0;)d.push(a.substring(b-=f,b+f)),f=dh[e=(e+1)%ih];return d.reverse().join(ch||"")+c}}jg.geo={},jg.geo.stream=function(a,b){a&&jh.hasOwnProperty(a.type)?jh[a.type](a,b):tb(a,b)};var jh={Feature:function(a,b){tb(a.geometry,b)},FeatureCollection:function(a,b){for(var c=a.features,d=-1,e=c.length;++da?4*Lg+a:a,oh.lineStart=oh.lineEnd=oh.point=E}};jg.geo.bounds=xb(lb),jg.geo.centroid=function(a){ph=qh=rh=sh=th=0,jg.geo.stream(a,uh);var b;return qh&&Math.abs(b=Math.sqrt(rh*rh+sh*sh+th*th))>Mg?[Math.atan2(sh,rh)*Og,Math.asin(Math.max(-1,Math.min(1,th/b)))*Og]:void 0};var ph,qh,rh,sh,th,uh={sphere:function(){2>ph&&(ph=2,qh=rh=sh=th=0)},point:yb,lineStart:Ab,lineEnd:Bb,polygonStart:function(){2>ph&&(ph=2,qh=rh=sh=th=0),uh.lineStart=zb},polygonEnd:function(){uh.lineStart=Ab}},vh=Nb(Ib,Sb,Ub),wh=1e9;jg.geo.projection=$b,jg.geo.projectionMutator=_b,(jg.geo.equirectangular=function(){return $b(bc)}).raw=bc.invert=bc,jg.geo.rotation=function(a){function b(b){return b=a(b[0]*Ng,b[1]*Ng),b[0]*=Og,b[1]*=Og,b}return a=cc(a[0]%360*Ng,a[1]*Ng,a.length>2?a[2]*Ng:0),b.invert=function(b){return b=a.invert(b[0]*Ng,b[1]*Ng),b[0]*=Og,b[1]*=Og,b},b},jg.geo.circle=function(){function a(){var a="function"==typeof d?d.apply(this,arguments):d,b=cc(-a[0]*Ng,-a[1]*Ng,0).invert,e=[];return c(null,null,1,{point:function(a,c){e.push(a=b(a,c)),a[0]*=Og,a[1]*=Og}}),{type:"Polygon",coordinates:[e]}}var b,c,d=[0,0],e=6;return a.origin=function(b){return arguments.length?(d=b,a):d},a.angle=function(d){return arguments.length?(c=gc((b=+d)*Ng,e*Ng),a):b},a.precision=function(d){return arguments.length?(c=gc(b*Ng,(e=+d)*Ng),a):e},a.angle(90)},jg.geo.distance=function(a,b){var c,d=(b[0]-a[0])*Ng,e=a[1]*Ng,f=b[1]*Ng,g=Math.sin(d),h=Math.cos(d),i=Math.sin(e),j=Math.cos(e),k=Math.sin(f),l=Math.cos(f);return Math.atan2(Math.sqrt((c=l*g)*c+(c=j*k-i*l*h)*c),i*k+j*l*h)},jg.geo.graticule=function(){function a(){return{type:"MultiLineString",coordinates:b()}}function b(){return jg.range(Math.ceil(f/q)*q,e,q).map(m).concat(jg.range(Math.ceil(j/r)*r,i,r).map(n)).concat(jg.range(Math.ceil(d/o)*o,c,o).filter(function(a){return Math.abs(a%q)>Mg}).map(k)).concat(jg.range(Math.ceil(h/p)*p,g,p).filter(function(a){return Math.abs(a%r)>Mg}).map(l))}var c,d,e,f,g,h,i,j,k,l,m,n,o=10,p=o,q=90,r=360,s=2.5;return a.lines=function(){return b().map(function(a){return{type:"LineString",coordinates:a}})},a.outline=function(){return{type:"Polygon",coordinates:[m(f).concat(n(i).slice(1),m(e).reverse().slice(1),n(j).reverse().slice(1))]}},a.extent=function(b){return arguments.length?a.majorExtent(b).minorExtent(b):a.minorExtent()},a.majorExtent=function(b){return arguments.length?(f=+b[0][0],e=+b[1][0],j=+b[0][1],i=+b[1][1],f>e&&(b=f,f=e,e=b),j>i&&(b=j,j=i,i=b),a.precision(s)):[[f,j],[e,i]]},a.minorExtent=function(b){return arguments.length?(d=+b[0][0],c=+b[1][0],h=+b[0][1],g=+b[1][1],d>c&&(b=d,d=c,c=b),h>g&&(b=h,h=g,g=b),a.precision(s)):[[d,h],[c,g]]},a.step=function(b){return arguments.length?a.majorStep(b).minorStep(b):a.minorStep()},a.majorStep=function(b){return arguments.length?(q=+b[0],r=+b[1],a):[q,r]},a.minorStep=function(b){return arguments.length?(o=+b[0],p=+b[1],a):[o,p]},a.precision=function(b){return arguments.length?(s=+b,k=ic(h,g,90),l=jc(d,c,s),m=ic(j,i,90),n=jc(f,e,s),a):s},a.majorExtent([[-180,-90+Mg],[180,90-Mg]]).minorExtent([[-180,-80-Mg],[180,80+Mg]])},jg.geo.greatArc=function(){function a(){return{type:"LineString",coordinates:[b||d.apply(this,arguments),c||e.apply(this,arguments)]}}var b,c,d=kc,e=lc;return a.distance=function(){return jg.geo.distance(b||d.apply(this,arguments),c||e.apply(this,arguments))},a.source=function(c){return arguments.length?(d=c,b="function"==typeof c?null:c,a):d},a.target=function(b){return arguments.length?(e=b,c="function"==typeof b?null:b,a):e},a.precision=function(){return arguments.length?a:0},a},jg.geo.interpolate=function(a,b){return mc(a[0]*Ng,a[1]*Ng,b[0]*Ng,b[1]*Ng)},jg.geo.length=function(a){return xh=0,jg.geo.stream(a,yh),xh};var xh,yh={sphere:E,point:E,lineStart:nc,lineEnd:E,polygonStart:E,polygonEnd:E};(jg.geo.conicEqualArea=function(){return oc(pc)}).raw=pc,jg.geo.albersUsa=function(){function a(a){return b(a)(a)}function b(a){var b=a[0],c=a[1];return c>50?g:-140>b?h:21>c?i:f}var c,d,e,f=jg.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]),g=jg.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]),h=jg.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]),i=jg.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);return a.invert=function(a){return c(a)||d(a)||e(a)||f.invert(a)},a.scale=function(b){return arguments.length?(f.scale(b),g.scale(.6*b),h.scale(b),i.scale(1.5*b),a.translate(f.translate())):f.scale()},a.translate=function(b){if(!arguments.length)return f.translate();var j=f.scale(),k=b[0],l=b[1];return f.translate(b),g.translate([k-.4*j,l+.17*j]),h.translate([k-.19*j,l+.2*j]),i.translate([k+.58*j,l+.43*j]),c=qc(g,[[-180,50],[-130,72]]),d=qc(h,[[-164,18],[-154,24]]),e=qc(i,[[-67.5,17.5],[-65,19]]),a},a.scale(1e3)};var zh,Ah,Bh={point:E,lineStart:E,lineEnd:E,polygonStart:function(){Ah=0,Bh.lineStart=rc},polygonEnd:function(){Bh.lineStart=Bh.lineEnd=Bh.point=E,zh+=Math.abs(Ah/2)}},Ch={point:tc,lineStart:uc,lineEnd:vc,polygonStart:function(){Ch.lineStart=wc},polygonEnd:function(){Ch.point=tc,Ch.lineStart=uc,Ch.lineEnd=vc}};jg.geo.path=function(){function a(a){return a&&jg.geo.stream(a,d(e.pointRadius("function"==typeof f?+f.apply(this,arguments):f))),e.result()}var b,c,d,e,f=4.5;return a.area=function(a){return zh=0,jg.geo.stream(a,d(Bh)),zh},a.centroid=function(a){return ph=rh=sh=th=0,jg.geo.stream(a,d(Ch)),th?[rh/th,sh/th]:void 0},a.bounds=function(a){return xb(d)(a)},a.projection=function(c){return arguments.length?(d=(b=c)?c.stream||zc(c):lb,a):b},a.context=function(b){return arguments.length?(e=null==(c=b)?new sc:new xc(b),a):c},a.pointRadius=function(b){return arguments.length?(f="function"==typeof b?b:+b,a):f},a.projection(jg.geo.albersUsa()).context(null)},jg.geo.albers=function(){return jg.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Dh=Ac(function(a){return Math.sqrt(2/(1+a))},function(a){return 2*Math.asin(a/2)});(jg.geo.azimuthalEqualArea=function(){return $b(Dh)}).raw=Dh;var Eh=Ac(function(a){var b=Math.acos(a);return b&&b/Math.sin(b)},lb);(jg.geo.azimuthalEquidistant=function(){return $b(Eh)}).raw=Eh,(jg.geo.conicConformal=function(){return oc(Bc)}).raw=Bc,(jg.geo.conicEquidistant=function(){return oc(Cc)}).raw=Cc;var Fh=Ac(function(a){return 1/a},Math.atan);(jg.geo.gnomonic=function(){return $b(Fh)}).raw=Fh,Dc.invert=function(a,b){return[a,2*Math.atan(Math.exp(b))-Lg/2]},(jg.geo.mercator=function(){return Ec(Dc)}).raw=Dc;var Gh=Ac(function(){return 1},Math.asin);(jg.geo.orthographic=function(){return $b(Gh)}).raw=Gh;var Hh=Ac(function(a){return 1/(1+a)},function(a){return 2*Math.atan(a)});(jg.geo.stereographic=function(){return $b(Hh)}).raw=Hh,Fc.invert=function(a,b){return[Math.atan2(R(a),Math.cos(b)),Q(Math.sin(b)/S(a))]},(jg.geo.transverseMercator=function(){return Ec(Fc)}).raw=Fc,jg.geom={},jg.svg={},jg.svg.line=function(){return Gc(lb)};var Ih=jg.map({linear:Jc,"linear-closed":Kc,"step-before":Lc,"step-after":Mc,basis:Sc,"basis-open":Tc,"basis-closed":Uc,bundle:Vc,cardinal:Pc,"cardinal-open":Nc,"cardinal-closed":Oc,monotone:_c});Ih.forEach(function(a,b){b.key=a,b.closed=/-closed$/.test(a)});var Jh=[0,2/3,1/3,0],Kh=[0,1/3,2/3,0],Lh=[0,1/6,2/3,1/6];jg.geom.hull=function(a){function b(a){if(a.length<3)return[];var b,e,f,g,h,i,j,k,l,m,n,o,p=kb(c),q=kb(d),r=a.length,s=r-1,t=[],u=[],v=0;if(p===Hc&&d===Ic)b=a;else for(f=0,b=[];r>f;++f)b.push([+p.call(this,e=a[f],f),+q.call(this,e,f)]);for(f=1;r>f;++f)b[f][1]f;++f)f!==v&&(i=b[f][1]-b[v][1],h=b[f][0]-b[v][0],t.push({angle:Math.atan2(i,h),index:f}));for(t.sort(function(a,b){return a.angle-b.angle}),n=t[0].angle,m=t[0].index,l=0,f=1;s>f;++f)g=t[f].index,n==t[f].angle?(h=b[m][0]-b[v][0],i=b[m][1]-b[v][1],j=b[g][0]-b[v][0],k=b[g][1]-b[v][1],h*h+i*i>=j*j+k*k?t[f].index=-1:(t[l].index=-1,n=t[f].angle,l=f,m=g)):(n=t[f].angle,l=f,m=g);for(u.push(v),f=0,g=0;2>f;++g)-1!==t[g].index&&(u.push(t[g].index),f++);for(o=u.length;s>g;++g)if(-1!==t[g].index){for(;!ad(u[o-2],u[o-1],t[g].index,b);)--o;u[o++]=t[g].index}var w=[];for(f=0;o>f;++f)w.push(a[u[f]]);return w}var c=Hc,d=Ic;return arguments.length?b(a):(b.x=function(a){return arguments.length?(c=a,b):c},b.y=function(a){return arguments.length?(d=a,b):d},b)},jg.geom.polygon=function(a){return a.area=function(){for(var b=0,c=a.length,d=a[c-1][1]*a[0][0]-a[c-1][0]*a[0][1];++bh;h++)c.push([e,b[h],b[h+1]])}),c},jg.geom.voronoi=function(a){function b(a){var b,d,g,h=a.map(function(){return[]}),i=kb(e),j=kb(f),k=a.length,l=1e6;if(i===Hc&&j===Ic)b=a;else for(b=[],g=0;k>g;++g)b.push([+i.call(this,d=a[g],g),+j.call(this,d,g)]);if(dd(b,function(a){var b,c,d,e,f,g;1===a.a&&a.b>=0?(b=a.ep.r,c=a.ep.l):(b=a.ep.l,c=a.ep.r),1===a.a?(f=b?b.y:-l,d=a.c-a.b*f,g=c?c.y:l,e=a.c-a.b*g):(d=b?b.x:-l,f=a.c-a.a*d,e=c?c.x:l,g=a.c-a.a*e);var i=[d,f],j=[e,g];h[a.region.l.index].push(i,j),h[a.region.r.index].push(i,j)}),h=h.map(function(a,c){var d=b[c][0],e=b[c][1],f=a.map(function(a){return Math.atan2(a[0]-d,a[1]-e)}),g=jg.range(a.length).sort(function(a,b){return f[a]-f[b]});return g.filter(function(a,b){return!b||f[a]-f[g[b-1]]>Mg}).map(function(b){return a[b]})}),h.forEach(function(a,c){var d=a.length;if(!d)return a.push([-l,-l],[-l,l],[l,l],[l,-l]);if(!(d>2)){var e=b[c],f=a[0],g=a[1],h=e[0],i=e[1],j=f[0],k=f[1],m=g[0],n=g[1],o=Math.abs(m-j),p=n-k;if(Math.abs(p)i?-l:l;a.push([-l,q],[l,q])}else if(Mg>o){var r=j>h?-l:l;a.push([r,-l],[r,l])}else{var q=(j-h)*(n-k)>(m-j)*(k-i)?l:-l,s=Math.abs(p)-o;Math.abs(s)p?q:-q,q]):(s>0&&(q*=-1),a.push([-l,q],[l,q]))}}}),c)for(g=0;k>g;++g)c(h[g]);for(g=0;k>g;++g)h[g].point=a[g];return h}var c,d=null,e=Hc,f=Ic;return arguments.length?b(a):(b.x=function(a){return arguments.length?(e=a,b):e},b.y=function(a){return arguments.length?(f=a,b):f},b.size=function(a){return arguments.length?(null==a?c=null:(d=[+a[0],+a[1]],c=jg.geom.polygon([[0,0],[0,d[1]],d,[d[0],0]]).clip),b):d},b.links=function(a){var b,c,d,g=a.map(function(){return[]}),h=[],i=kb(e),j=kb(f),k=a.length;if(i===Hc&&j===Ic)b=a;else for(d=0;k>d;++d)b.push([+i.call(this,c=a[d],d),+j.call(this,c,d)]);return dd(b,function(b){var c=b.region.l.index,d=b.region.r.index;g[c][d]||(g[c][d]=g[d][c]=!0,h.push({source:a[c],target:a[d]}))}),h},b.triangles=function(a){if(e===Hc&&f===Ic)return jg.geom.delaunay(a); @@ -10,4 +10,4 @@ if(z)A[0]=l[0][0]-A[0],A[1]=l[0][1]-A[1];else if(w){var C=+/w$/.test(w),D=+/^n/. },a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),h.color(m),a):m},a.showControls=function(b){return arguments.length?(n=b,a):n},a.showLegend=function(b){return arguments.length?(o=b,a):o},a.showXAxis=function(b){return arguments.length?(p=b,a):p},a.showYAxis=function(b){return arguments.length?(q=b,a):q},a.tooltip=function(b){return arguments.length?(t=b,a):t},a.tooltips=function(b){return arguments.length?(s=b,a):s},a.tooltipContent=function(b){return arguments.length?(t=b,a):t},a.state=function(b){return arguments.length?(u=b,a):u},a.defaultState=function(b){return arguments.length?(v=b,a):v},a.noData=function(b){return arguments.length?(w=b,a):w},a.transitionDuration=function(b){return arguments.length?(z=b,a):z},a},c.models.multiChart=function(){"use strict";function a(c){return c.each(function(c){var l=d3.select(this),A=this;a.update=function(){l.transition().call(a)},a.container=this;var B=(h||parseInt(l.style("width"))||960)-f.left-f.right,C=(i||parseInt(l.style("height"))||400)-f.top-f.bottom,D=c.filter(function(a){return!a.disabled&&"line"==a.type&&1==a.yAxis}),E=c.filter(function(a){return!a.disabled&&"line"==a.type&&2==a.yAxis}),F=c.filter(function(a){return!a.disabled&&"bar"==a.type&&1==a.yAxis}),G=c.filter(function(a){return!a.disabled&&"bar"==a.type&&2==a.yAxis}),H=c.filter(function(a){return!a.disabled&&"area"==a.type&&1==a.yAxis}),I=c.filter(function(a){return!a.disabled&&"area"==a.type&&2==a.yAxis}),J=c.filter(function(a){return!a.disabled&&1==a.yAxis}).map(function(a){return a.values.map(function(a){return{x:a.x,y:a.y}})}),K=c.filter(function(a){return!a.disabled&&2==a.yAxis}).map(function(a){return a.values.map(function(a){return{x:a.x,y:a.y}})});b.domain(d3.extent(d3.merge(J.concat(K)),function(a){return a.x})).range([0,B]);var L=l.selectAll("g.wrap.multiChart").data([c]),M=L.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");M.append("g").attr("class","x axis"),M.append("g").attr("class","y1 axis"),M.append("g").attr("class","y2 axis"),M.append("g").attr("class","lines1Wrap"),M.append("g").attr("class","lines2Wrap"),M.append("g").attr("class","bars1Wrap"),M.append("g").attr("class","bars2Wrap"),M.append("g").attr("class","stack1Wrap"),M.append("g").attr("class","stack2Wrap"),M.append("g").attr("class","legendWrap");var N=L.select("g");j&&(x.width(B/2),N.select(".legendWrap").datum(c.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(1==a.yAxis?"":" (right axis)"),a})).call(x),f.top!=x.height()&&(f.top=x.height(),C=(i||parseInt(l.style("height"))||400)-f.top-f.bottom),N.select(".legendWrap").attr("transform","translate("+B/2+","+-f.top+")")),o.width(B).height(C).interpolate("monotone").color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&1==c[b].yAxis&&"line"==c[b].type})),p.width(B).height(C).interpolate("monotone").color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&2==c[b].yAxis&&"line"==c[b].type})),q.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&1==c[b].yAxis&&"bar"==c[b].type})),r.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&2==c[b].yAxis&&"bar"==c[b].type})),s.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&1==c[b].yAxis&&"area"==c[b].type})),t.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&2==c[b].yAxis&&"area"==c[b].type})),N.attr("transform","translate("+f.left+","+f.top+")");var O=N.select(".lines1Wrap").datum(D),P=N.select(".bars1Wrap").datum(F),Q=N.select(".stack1Wrap").datum(H),R=N.select(".lines2Wrap").datum(E),S=N.select(".bars2Wrap").datum(G),T=N.select(".stack2Wrap").datum(I),U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],V=I.length?I.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];m.domain(d||d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,C]),n.domain(e||d3.extent(d3.merge(K).concat(V),function(a){return a.y})).range([0,C]),o.yDomain(m.domain()),q.yDomain(m.domain()),s.yDomain(m.domain()),p.yDomain(n.domain()),r.yDomain(n.domain()),t.yDomain(n.domain()),H.length&&d3.transition(Q).call(s),I.length&&d3.transition(T).call(t),F.length&&d3.transition(P).call(q),G.length&&d3.transition(S).call(r),D.length&&d3.transition(O).call(o),E.length&&d3.transition(R).call(p),u.ticks(B/100).tickSize(-C,0),N.select(".x.axis").attr("transform","translate(0,"+C+")"),d3.transition(N.select(".x.axis")).call(u),v.ticks(C/36).tickSize(-B,0),d3.transition(N.select(".y1.axis")).call(v),w.ticks(C/36).tickSize(-B,0),d3.transition(N.select(".y2.axis")).call(w),N.select(".y2.axis").style("opacity",K.length?1:0).attr("transform","translate("+b.range()[1]+",0)"),x.dispatch.on("stateChange",function(){a.update()}),y.on("tooltipShow",function(a){k&&z(a,A.parentNode)})}),a}var b,d,e,f={top:30,right:20,bottom:50,left:60},g=d3.scale.category20().range(),h=null,i=null,j=!0,k=!0,l=function(a,b,c){return"

"+a+"

"+c+" at "+b+"

"},b=d3.scale.linear(),m=d3.scale.linear(),n=d3.scale.linear(),o=c.models.line().yScale(m),p=c.models.line().yScale(n),q=c.models.multiBar().stacked(!1).yScale(m),r=c.models.multiBar().stacked(!1).yScale(n),s=c.models.stackedArea().yScale(m),t=c.models.stackedArea().yScale(n),u=c.models.axis().scale(b).orient("bottom").tickPadding(5),v=c.models.axis().scale(m).orient("left"),w=c.models.axis().scale(n).orient("right"),x=c.models.legend().height(30),y=d3.dispatch("tooltipShow","tooltipHide"),z=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),f=b.pos[1]+(d.offsetTop||0),g=u.tickFormat()(o.x()(b.point,b.pointIndex)),h=(2==b.series.yAxis?w:v).tickFormat()(o.y()(b.point,b.pointIndex)),i=l(b.series.key,g,h,b,a);c.tooltip.show([e,f],i,void 0,void 0,d.offsetParent)};return o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),q.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),q.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),r.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),r.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),s.dispatch.on("tooltipShow",function(a){return Math.round(100*s.y()(a.point))?(a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],void y.tooltipShow(a)):(setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1)}),s.dispatch.on("tooltipHide",function(a){y.tooltipHide(a)}),t.dispatch.on("tooltipShow",function(a){return Math.round(100*t.y()(a.point))?(a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],void y.tooltipShow(a)):(setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1)}),t.dispatch.on("tooltipHide",function(a){y.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){k&&c.tooltip.cleanup()}),a.dispatch=y,a.lines1=o,a.lines2=p,a.bars1=q,a.bars2=r,a.stack1=s,a.stack2=t,a.xAxis=u,a.yAxis1=v,a.yAxis2=w,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(getX=b,o.x(b),q.x(b),a):getX},a.y=function(b){return arguments.length?(getY=b,o.y(b),q.y(b),a):getY},a.yDomain1=function(b){return arguments.length?(d=b,a):d},a.yDomain2=function(b){return arguments.length?(e=b,a):e},a.margin=function(b){return arguments.length?(f=b,a):f},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.color=function(b){return arguments.length?(g=b,x.color(b),a):g},a.showLegend=function(b){return arguments.length?(j=b,a):j},a.tooltips=function(b){return arguments.length?(k=b,a):k},a.tooltipContent=function(b){return arguments.length?(l=b,a):l},a},c.models.ohlcBar=function(){"use strict";function a(c){return c.each(function(a){var c=h-g.left-g.right,w=i-g.top-g.bottom,y=d3.select(this);k.domain(b||d3.extent(a[0].values.map(m).concat(s))),k.range(u?e||[.5*c/a[0].values.length,c*(a[0].values.length-.5)/a[0].values.length]:e||[0,c]),l.domain(d||[d3.min(a[0].values.map(r).concat(t)),d3.max(a[0].values.map(q).concat(t))]).range(f||[w,0]),k.domain()[0]===k.domain()[1]&&k.domain(k.domain()[0]?[k.domain()[0]-.01*k.domain()[0],k.domain()[1]+.01*k.domain()[1]]:[-1,1]),l.domain()[0]===l.domain()[1]&&l.domain(l.domain()[0]?[l.domain()[0]+.01*l.domain()[0],l.domain()[1]-.01*l.domain()[1]]:[-1,1]);var z=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-ticks"),z.attr("transform","translate("+g.left+","+g.top+")"),y.on("click",function(a,b){x.chartClick({data:a,index:b,pos:d3.event,id:j})}),B.append("clipPath").attr("id","nv-chart-clip-path-"+j).append("rect"),z.select("#nv-chart-clip-path-"+j+" rect").attr("width",c).attr("height",w),D.attr("clip-path",v?"url(#nv-chart-clip-path-"+j+")":"");var E=z.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});E.exit().remove();E.enter().append("path").attr("class",function(a,b,c){return(o(a,b)>p(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,d){var e=c/a[0].values.length*.9;return"m0,0l0,"+(l(o(b,d))-l(q(b,d)))+"l"+-e/2+",0l"+e/2+",0l0,"+(l(r(b,d))-l(o(b,d)))+"l0,"+(l(p(b,d))-l(r(b,d)))+"l"+e/2+",0l"+-e/2+",0z"}).attr("transform",function(a,b){return"translate("+k(m(a,b))+","+l(q(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),x.elementMouseover({point:b,series:a[0],pos:[k(m(b,c)),l(n(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),x.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){x.elementClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation()}).on("dblclick",function(a,b){x.elementDblClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation()});E.attr("class",function(a,b,c){return(o(a,b)>p(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(E).attr("transform",function(a,b){return"translate("+k(m(a,b))+","+l(q(a,b))+")"}).attr("d",function(b,d){var e=c/a[0].values.length*.9;return"m0,0l0,"+(l(o(b,d))-l(q(b,d)))+"l"+-e/2+",0l"+e/2+",0l0,"+(l(r(b,d))-l(o(b,d)))+"l0,"+(l(p(b,d))-l(r(b,d)))+"l"+e/2+",0l"+-e/2+",0z"})}),a}var b,d,e,f,g={top:0,right:0,bottom:0,left:0},h=960,i=500,j=Math.floor(1e4*Math.random()),k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=function(a){return a.open},p=function(a){return a.close},q=function(a){return a.high},r=function(a){return a.low},s=[],t=[],u=!1,v=!0,w=c.utils.defaultColor(),x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=x,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(m=b,a):m},a.y=function(b){return arguments.length?(n=b,a):n},a.open=function(b){return arguments.length?(o=b,a):o},a.close=function(b){return arguments.length?(p=b,a):p},a.high=function(b){return arguments.length?(q=b,a):q},a.low=function(b){return arguments.length?(r=b,a):r},a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceX=function(b){return arguments.length?(s=b,a):s},a.forceY=function(b){return arguments.length?(t=b,a):t},a.padData=function(b){return arguments.length?(u=b,a):u},a.clipEdge=function(b){return arguments.length?(v=b,a):v},a.color=function(b){return arguments.length?(w=c.utils.getColor(b),a):w},a.id=function(b){return arguments.length?(j=b,a):j},a},c.models.pie=function(){"use strict";function a(c){return c.each(function(a){function c(a){a.endAngle=isNaN(a.endAngle)?0:a.endAngle,a.startAngle=isNaN(a.startAngle)?0:a.startAngle,r||(a.innerRadius=0);var b=d3.interpolate(this._current,a);return this._current=b(0),function(a){return E(b(a))}}var i=e-b.left-b.right,l=f-b.top-b.bottom,x=Math.min(i,l)/2,y=x-x/5,z=d3.select(this),A=z.selectAll(".nv-wrap.nv-pie").data(a),B=A.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+j),C=B.append("g"),D=A.select("g");C.append("g").attr("class","nv-pie"),C.append("g").attr("class","nv-pieLabels"),A.attr("transform","translate("+b.left+","+b.top+")"),D.select(".nv-pie").attr("transform","translate("+i/2+","+l/2+")"),D.select(".nv-pieLabels").attr("transform","translate("+i/2+","+l/2+")"),z.on("click",function(a,b){w.chartClick({data:a,index:b,pos:d3.event,id:j})});var E=d3.svg.arc().outerRadius(y);t&&E.startAngle(t),u&&E.endAngle(u),r&&E.innerRadius(x*v);var F=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:h(a)}),G=A.select(".nv-pie").selectAll(".nv-slice").data(F),H=A.select(".nv-pieLabels").selectAll(".nv-label").data(F);G.exit().remove(),H.exit().remove();var I=G.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),w.elementMouseover({label:g(a.data),value:h(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:j})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),w.elementMouseout({label:g(a.data),value:h(a.data),point:a.data,index:b,id:j})}).on("click",function(a,b){w.elementClick({label:g(a.data),value:h(a.data),point:a.data,index:b,pos:d3.event,id:j}),d3.event.stopPropagation()}).on("dblclick",function(a,b){w.elementDblClick({label:g(a.data),value:h(a.data),point:a.data,index:b,pos:d3.event,id:j}),d3.event.stopPropagation()});G.attr("fill",function(a,b){return k(a,b)}).attr("stroke",function(a,b){return k(a,b)});I.append("path").each(function(a){this._current=a});if(G.select("path").transition().attr("d",E).attrTween("d",c),m){var J=d3.svg.arc().innerRadius(0);n&&(J=E),o&&(J=d3.svg.arc().outerRadius(E.outerRadius())),H.enter().append("g").classed("nv-label",!0).each(function(a){var b=d3.select(this);b.attr("transform",function(a){if(s){a.outerRadius=y+10,a.innerRadius=y+15;var b=(a.startAngle+a.endAngle)/2*(180/Math.PI);return(a.startAngle+a.endAngle)/2q?c[p]:""})}}),a}var b={top:0,right:0,bottom:0,left:0},e=500,f=500,g=function(a){return a.x},h=function(a){return a.y},i=function(a){return a.description},j=Math.floor(1e4*Math.random()),k=c.utils.defaultColor(),l=d3.format(",.2f"),m=!0,n=!0,o=!1,p="key",q=.02,r=!1,s=!1,t=!1,u=!1,v=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=w,a.options=c.utils.optionsFunc.bind(a),a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.width=function(b){return arguments.length?(e=b,a):e},a.height=function(b){return arguments.length?(f=b,a):f},a.values=function(){return c.log("pie.values() is no longer supported."),a},a.x=function(b){return arguments.length?(g=b,a):g},a.y=function(b){return arguments.length?(h=d3.functor(b),a):h},a.description=function(b){return arguments.length?(i=b,a):i},a.showLabels=function(b){return arguments.length?(m=b,a):m},a.labelSunbeamLayout=function(b){return arguments.length?(s=b,a):s},a.donutLabelsOutside=function(b){return arguments.length?(o=b,a):o},a.pieLabelsOutside=function(b){return arguments.length?(n=b,a):n},a.labelType=function(b){return arguments.length?(p=b,p=p||"key",a):p},a.donut=function(b){return arguments.length?(r=b,a):r},a.donutRatio=function(b){return arguments.length?(v=b,a):v},a.startAngle=function(b){return arguments.length?(t=b,a):t},a.endAngle=function(b){return arguments.length?(u=b,a):u},a.id=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(k=c.utils.getColor(b),a):k},a.valueFormat=function(b){return arguments.length?(l=b,a):l},a.labelThreshold=function(b){return arguments.length?(q=b,a):q},a},c.models.pieChart=function(){"use strict";function a(c){return c.each(function(c){var i=d3.select(this),j=(f||parseInt(i.style("width"))||960)-e.left-e.right,k=(g||parseInt(i.style("height"))||400)-e.top-e.bottom;if(a.update=function(){i.transition().call(a)},a.container=this,l.disabled=c.map(function(a){return!!a.disabled}),!m){var p;m={};for(p in l)m[p]=l[p]instanceof Array?l[p].slice(0):l[p]}if(!c||!c.length){var q=i.selectAll(".nv-noData").data([n]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",e.left+j/2).attr("y",e.top+k/2).text(function(a){return a}),a}i.selectAll(".nv-noData").remove();var r=i.selectAll("g.nv-wrap.nv-pieChart").data([c]),s=r.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),t=r.select("g");s.append("g").attr("class","nv-pieWrap"),s.append("g").attr("class","nv-legendWrap"),h&&(d.width(j).key(b.x()),r.select(".nv-legendWrap").datum(c).call(d),e.top!=d.height()&&(e.top=d.height(),k=(g||parseInt(i.style("height"))||400)-e.top-e.bottom),r.select(".nv-legendWrap").attr("transform","translate(0,"+-e.top+")")),r.attr("transform","translate("+e.left+","+e.top+")"),b.width(j).height(k);var u=t.select(".nv-pieWrap").datum([c]);d3.transition(u).call(b),d.dispatch.on("stateChange",function(b){l=b,o.stateChange(l),a.update()}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),l.disabled=b.disabled),a.update()})}),a}var b=c.models.pie(),d=c.models.legend(),e={top:30,right:20,bottom:20,left:20},f=null,g=null,h=!0,i=c.utils.defaultColor(),j=!0,k=function(a,b){return"

"+a+"

"+b+"

"},l={},m=null,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),p=function(d,e){var f=b.description()(d.point)||b.x()(d.point),g=d.pos[0]+(e&&e.offsetLeft||0),h=d.pos[1]+(e&&e.offsetTop||0),i=b.valueFormat()(b.y()(d.point)),j=k(f,i,d,a);c.tooltip.show([g,h],j,d.value<0?"n":"s",null,e)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),o.on("tooltipShow",function(a){j&&p(a)}),o.on("tooltipHide",function(){j&&c.tooltip.cleanup()}),a.legend=d,a.dispatch=o,a.pie=b,d3.rebind(a,b,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(e.top="undefined"!=typeof b.top?b.top:e.top,e.right="undefined"!=typeof b.right?b.right:e.right,e.bottom="undefined"!=typeof b.bottom?b.bottom:e.bottom,e.left="undefined"!=typeof b.left?b.left:e.left,a):e},a.width=function(b){return arguments.length?(f=b,a):f},a.height=function(b){return arguments.length?(g=b,a):g},a.color=function(e){return arguments.length?(i=c.utils.getColor(e),d.color(i),b.color(i),a):i},a.showLegend=function(b){return arguments.length?(h=b,a):h},a.tooltips=function(b){return arguments.length?(j=b,a):j},a.tooltipContent=function(b){return arguments.length?(k=b,a):k},a.state=function(b){return arguments.length?(l=b,a):l},a.defaultState=function(b){return arguments.length?(m=b,a):m},a.noData=function(b){return arguments.length?(n=b,a):n},a},c.models.scatter=function(){"use strict";function a(O){return O.each(function(a){function O(){if(!w)return!1;var b=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){var d=o(a,c),e=p(a,c);return[l(d)+1e-7*Math.random(),m(e)+1e-7*Math.random(),b,c,a]}).filter(function(a,b){return y(a[4],b)})}));if(M===!0){if(C){var c=T.select("defs").selectAll(".nv-point-clips").data([k]).enter();c.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+k);var d=T.select("#nv-points-clip-"+k).selectAll("circle").data(b);d.enter().append("circle").attr("r",D),d.exit().remove(),d.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),T.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+k+")")}b.length&&(b.push([l.range()[0]-20,m.range()[0]-20,null,null]),b.push([l.range()[1]+20,m.range()[1]+20,null,null]),b.push([l.range()[0]-20,m.range()[0]+20,null,null]),b.push([l.range()[1]+20,m.range()[1]-20,null,null]));var e=d3.geom.polygon([[-10,-10],[-10,i+10],[h+10,i+10],[h+10,-10]]),f=d3.geom.voronoi(b).map(function(a,c){return{data:e.clip(a),series:b[c][2],point:b[c][3]}}),j=T.select(".nv-point-paths").selectAll("path").data(f);j.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),j.exit().remove(),j.attr("d",function(a){return 0===a.data.length?"M 0 0":"M"+a.data.join("L")+"Z"});var n=function(b,c){if(N)return 0;var d=a[b.series];if("undefined"!=typeof d){var e=d.values[b.point];c({point:e,series:d,pos:[l(o(e,b.point))+g.left,m(p(e,b.point))+g.top],seriesIndex:b.series,pointIndex:b.point})}};j.on("click",function(a){n(a,L.elementClick)}).on("mouseover",function(a){n(a,L.elementMouseover)}).on("mouseout",function(a){n(a,L.elementMouseout)})}else T.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(b,c){if(N||!a[b.series])return 0;var d=a[b.series],e=d.values[c];L.elementClick({point:e,series:d,pos:[l(o(e,c))+g.left,m(p(e,c))+g.top],seriesIndex:b.series,pointIndex:c})}).on("mouseover",function(b,c){if(N||!a[b.series])return 0;var d=a[b.series],e=d.values[c];L.elementMouseover({point:e,series:d,pos:[l(o(e,c))+g.left,m(p(e,c))+g.top],seriesIndex:b.series,pointIndex:c})}).on("mouseout",function(b,c){if(N||!a[b.series])return 0;var d=a[b.series],e=d.values[c];L.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:c})});N=!1}var P=h-g.left-g.right,Q=i-g.top-g.bottom,R=d3.select(this);a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})});var S=E&&F&&I?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:o(a,b),y:p(a,b),size:q(a,b)}})}));l.domain(E||d3.extent(S.map(function(a){return a.x}).concat(t))),l.range(z&&a[0]?G||[(P*A+P)/(2*a[0].values.length),P-P*(1+A)/(2*a[0].values.length)]:G||[0,P]),m.domain(F||d3.extent(S.map(function(a){return a.y}).concat(u))).range(H||[Q,0]),n.domain(I||d3.extent(S.map(function(a){return a.size}).concat(v))).range(J||[16,256]),(l.domain()[0]===l.domain()[1]||m.domain()[0]===m.domain()[1])&&(K=!0),l.domain()[0]===l.domain()[1]&&l.domain(l.domain()[0]?[l.domain()[0]-.01*l.domain()[0],l.domain()[1]+.01*l.domain()[1]]:[-1,1]),m.domain()[0]===m.domain()[1]&&m.domain(m.domain()[0]?[m.domain()[0]-.01*m.domain()[0],m.domain()[1]+.01*m.domain()[1]]:[-1,1]),isNaN(l.domain()[0])&&l.domain([-1,1]),isNaN(m.domain()[0])&&m.domain([-1,1]),b=b||l,d=d||m,e=e||n;var T=R.selectAll("g.nv-wrap.nv-scatter").data([a]),U=T.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+k+(K?" nv-single-point":"")),V=U.append("defs"),W=U.append("g"),X=T.select("g");W.append("g").attr("class","nv-groups"),W.append("g").attr("class","nv-point-paths"),T.attr("transform","translate("+g.left+","+g.top+")"),V.append("clipPath").attr("id","nv-edge-clip-"+k).append("rect"),T.select("#nv-edge-clip-"+k+" rect").attr("width",P).attr("height",Q>0?Q:0),X.attr("clip-path",B?"url(#nv-edge-clip-"+k+")":""),N=!0;var Y=T.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});if(Y.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),Y.exit().remove(),Y.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),Y.transition().style("fill",function(a,b){return j(a,b)}).style("stroke",function(a,b){return j(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5),s){var Z=Y.selectAll("circle.nv-point").data(function(a){return a.values},x);Z.enter().append("circle").style("fill",function(a){return a.color}).style("stroke",function(a){return a.color}).attr("cx",function(a,d){return c.utils.NaNtoZero(b(o(a,d)))}).attr("cy",function(a,b){return c.utils.NaNtoZero(d(p(a,b)))}).attr("r",function(a,b){return Math.sqrt(n(q(a,b))/Math.PI)}),Z.exit().remove(),Y.exit().selectAll("path.nv-point").transition().attr("cx",function(a,b){return c.utils.NaNtoZero(l(o(a,b)))}).attr("cy",function(a,b){return c.utils.NaNtoZero(m(p(a,b)))}).remove(),Z.each(function(a,b){d3.select(this).classed("nv-point",!0).classed("nv-point-"+b,!0).classed("hover",!1)}),Z.transition().attr("cx",function(a,b){return c.utils.NaNtoZero(l(o(a,b)))}).attr("cy",function(a,b){return c.utils.NaNtoZero(m(p(a,b)))}).attr("r",function(a,b){return Math.sqrt(n(q(a,b))/Math.PI)})}else{var Z=Y.selectAll("path.nv-point").data(function(a){return a.values});Z.enter().append("path").style("fill",function(a){return a.color}).style("stroke",function(a){return a.color}).attr("transform",function(a,c){return"translate("+b(o(a,c))+","+d(p(a,c))+")"}).attr("d",d3.svg.symbol().type(r).size(function(a,b){return n(q(a,b))})),Z.exit().remove(),Y.exit().selectAll("path.nv-point").transition().attr("transform",function(a,b){return"translate("+l(o(a,b))+","+m(p(a,b))+")"}).remove(),Z.each(function(a,b){d3.select(this).classed("nv-point",!0).classed("nv-point-"+b,!0).classed("hover",!1)}),Z.transition().attr("transform",function(a,b){return"translate("+l(o(a,b))+","+m(p(a,b))+")"}).attr("d",d3.svg.symbol().type(r).size(function(a,b){return n(q(a,b))}))}clearTimeout(f),f=setTimeout(O,300),b=l.copy(),d=m.copy(),e=n.copy()}),a}var b,d,e,f,g={top:0,right:0,bottom:0,left:0},h=960,i=500,j=c.utils.defaultColor(),k=Math.floor(1e5*Math.random()),l=d3.scale.linear(),m=d3.scale.linear(),n=d3.scale.linear(),o=function(a){return a.x},p=function(a){return a.y},q=function(a){return a.size||1},r=function(a){return a.shape||"circle"},s=!0,t=[],u=[],v=[],w=!0,x=null,y=function(a){return!a.notActive},z=!1,A=.1,B=!1,C=!0,D=function(){return 25},E=null,F=null,G=null,H=null,I=null,J=null,K=!1,L=d3.dispatch("elementClick","elementMouseover","elementMouseout"),M=!0,N=!1;return a.clearHighlights=function(){d3.selectAll(".nv-chart-"+k+" .nv-point.hover").classed("hover",!1)},a.highlightPoint=function(a,b,c){d3.select(".nv-chart-"+k+" .nv-series-"+a+" .nv-point-"+b).classed("hover",c)},L.on("elementMouseover.point",function(b){w&&a.highlightPoint(b.seriesIndex,b.pointIndex,!0)}),L.on("elementMouseout.point",function(b){w&&a.highlightPoint(b.seriesIndex,b.pointIndex,!1)}),a.dispatch=L,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=d3.functor(b),a):o},a.y=function(b){return arguments.length?(p=d3.functor(b),a):p},a.size=function(b){return arguments.length?(q=d3.functor(b),a):q},a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.xScale=function(b){return arguments.length?(l=b,a):l},a.yScale=function(b){return arguments.length?(m=b,a):m},a.zScale=function(b){return arguments.length?(n=b,a):n},a.xDomain=function(b){return arguments.length?(E=b,a):E},a.yDomain=function(b){return arguments.length?(F=b,a):F},a.sizeDomain=function(b){return arguments.length?(I=b,a):I},a.xRange=function(b){return arguments.length?(G=b,a):G},a.yRange=function(b){return arguments.length?(H=b,a):H},a.sizeRange=function(b){return arguments.length?(J=b,a):J},a.forceX=function(b){return arguments.length?(t=b,a):t},a.forceY=function(b){return arguments.length?(u=b,a):u},a.forceSize=function(b){return arguments.length?(v=b,a):v},a.interactive=function(b){return arguments.length?(w=b,a):w},a.pointKey=function(b){return arguments.length?(x=b,a):x},a.pointActive=function(b){return arguments.length?(y=b,a):y},a.padData=function(b){return arguments.length?(z=b,a):z},a.padDataOuter=function(b){return arguments.length?(A=b,a):A},a.clipEdge=function(b){return arguments.length?(B=b,a):B},a.clipVoronoi=function(b){return arguments.length?(C=b,a):C},a.useVoronoi=function(b){return arguments.length?(M=b,M===!1&&(C=!1),a):M},a.clipRadius=function(b){return arguments.length?(D=b,a):D},a.color=function(b){return arguments.length?(j=c.utils.getColor(b),a):j},a.shape=function(b){return arguments.length?(r=b,a):r},a.onlyCircles=function(b){return arguments.length?(s=b,a):s},a.id=function(b){return arguments.length?(k=b,a):k},a.singlePoint=function(b){return arguments.length?(K=b,a):K},a},c.models.scatterChart=function(){"use strict";function a(c){return c.each(function(c){function B(){if(z)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);n.distortion(y).focus(a[0]),o.distortion(y).focus(a[1]),U.select(".nv-scatterWrap").call(b),u&&U.select(".nv-x.nv-axis").call(d),v&&U.select(".nv-y.nv-axis").call(e),U.select(".nv-distributionX").datum(c.filter(function(a){return!a.disabled})).call(h),U.select(".nv-distributionY").datum(c.filter(function(a){return!a.disabled})).call(i)}var C=d3.select(this),D=this,N=(k||parseInt(C.style("width"))||960)-j.left-j.right,O=(l||parseInt(C.style("height"))||400)-j.top-j.bottom; if(a.update=function(){C.transition().duration(I).call(a)},a.container=this,E.disabled=c.map(function(a){return!!a.disabled}),!F){var P;F={};for(P in E)F[P]=E[P]instanceof Array?E[P].slice(0):E[P]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var Q=C.selectAll(".nv-noData").data([H]);return Q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),Q.attr("x",j.left+N/2).attr("y",j.top+O/2).text(function(a){return a}),a}C.selectAll(".nv-noData").remove(),J=J||n,K=K||o;var R=C.selectAll("g.nv-wrap.nv-scatterChart").data([c]),S=R.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),T=S.append("g"),U=R.select("g");if(T.append("rect").attr("class","nvd3 nv-background"),T.append("g").attr("class","nv-x nv-axis"),T.append("g").attr("class","nv-y nv-axis"),T.append("g").attr("class","nv-scatterWrap"),T.append("g").attr("class","nv-distWrap"),T.append("g").attr("class","nv-legendWrap"),T.append("g").attr("class","nv-controlsWrap"),t){var V=x?N/2:N;f.width(V),R.select(".nv-legendWrap").datum(c).call(f),j.top!=f.height()&&(j.top=f.height(),O=(l||parseInt(C.style("height"))||400)-j.top-j.bottom),R.select(".nv-legendWrap").attr("transform","translate("+(N-V)+","+-j.top+")")}if(x&&(g.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+-j.top+")").call(g)),R.attr("transform","translate("+j.left+","+j.top+")"),w&&U.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)"),b.width(N).height(O).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),0!==p&&b.xDomain(null),0!==q&&b.yDomain(null),R.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),0!==p){var W=n.domain()[1]-n.domain()[0];b.xDomain([n.domain()[0]-p*W,n.domain()[1]+p*W])}if(0!==q){var X=o.domain()[1]-o.domain()[0];b.yDomain([o.domain()[0]-q*X,o.domain()[1]+q*X])}(0!==q||0!==p)&&R.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),u&&(d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():N/100).tickSize(-O,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")").call(d)),v&&(e.scale(o).ticks(e.ticks()&&e.ticks().length?e.ticks():O/36).tickSize(-N,0),U.select(".nv-y.nv-axis").call(e)),r&&(h.getData(b.x()).scale(n).width(N).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),T.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+o.range()[0]+")").datum(c.filter(function(a){return!a.disabled})).call(h)),s&&(i.getData(b.y()).scale(o).width(O).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),T.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate("+(w?N:-i.size())+",0)").datum(c.filter(function(a){return!a.disabled})).call(i)),d3.fisheye&&(U.select(".nv-background").attr("width",N).attr("height",O),U.select(".nv-background").on("mousemove",B),U.select(".nv-background").on("click",function(){z=!z}),b.dispatch.on("elementClick.freezeFisheye",function(){z=!z})),g.dispatch.on("legendClick",function(c){c.disabled=!c.disabled,y=c.disabled?0:2.5,U.select(".nv-background").style("pointer-events",c.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",c.disabled?"all":"none"),c.disabled?(n.distortion(y).focus(0),o.distortion(y).focus(0),U.select(".nv-scatterWrap").call(b),U.select(".nv-x.nv-axis").call(d),U.select(".nv-y.nv-axis").call(e)):z=!1,a.update()}),f.dispatch.on("stateChange",function(b){E.disabled=b.disabled,G.stateChange(E),a.update()}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",function(){return a.pos[1]-O}),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+h.size()),a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],G.tooltipShow(a)}),G.on("tooltipShow",function(a){A&&L(a,D.parentNode)}),G.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),E.disabled=b.disabled),a.update()}),J=n.copy(),K=o.copy()}),a}var b=c.models.scatter(),d=c.models.axis(),e=c.models.axis(),f=c.models.legend(),g=c.models.legend(),h=c.models.distribution(),i=c.models.distribution(),j={top:30,right:20,bottom:50,left:75},k=null,l=null,m=c.utils.defaultColor(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),o=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),p=0,q=0,r=!1,s=!1,t=!0,u=!0,v=!0,w=!1,x=!!d3.fisheye,y=0,z=!1,A=!0,B=function(a,b){return""+b+""},C=function(a,b,c){return""+c+""},D=null,E={},F=null,G=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),H="No Data Available.",I=250;b.xScale(n).yScale(o),d.orient("bottom").tickPadding(10),e.orient(w?"right":"left").tickPadding(10),h.axis("x"),i.axis("y"),g.updateState(!1);var J,K,L=function(f,g){var h=f.pos[0]+(g.offsetLeft||0),i=f.pos[1]+(g.offsetTop||0),k=f.pos[0]+(g.offsetLeft||0),l=o.range()[0]+j.top+(g.offsetTop||0),m=n.range()[0]+j.left+(g.offsetLeft||0),p=f.pos[1]+(g.offsetTop||0),q=d.tickFormat()(b.x()(f.point,f.pointIndex)),r=e.tickFormat()(b.y()(f.point,f.pointIndex));null!=B&&c.tooltip.show([k,l],B(f.series.key,q,r,f,a),"n",1,g,"x-nvtooltip"),null!=C&&c.tooltip.show([m,p],C(f.series.key,q,r,f,a),"e",1,g,"y-nvtooltip"),null!=D&&c.tooltip.show([h,i],D(f.series.key,q,r,f,a),f.value<0?"n":"s",null,g)},M=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){G.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",i.size())}),G.on("tooltipHide",function(){A&&c.tooltip.cleanup()}),a.dispatch=G,a.scatter=b,a.legend=f,a.controls=g,a.xAxis=d,a.yAxis=e,a.distX=h,a.distY=i,d3.rebind(a,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),f.color(m),h.color(m),i.color(m),a):m},a.showDistX=function(b){return arguments.length?(r=b,a):r},a.showDistY=function(b){return arguments.length?(s=b,a):s},a.showControls=function(b){return arguments.length?(x=b,a):x},a.showLegend=function(b){return arguments.length?(t=b,a):t},a.showXAxis=function(b){return arguments.length?(u=b,a):u},a.showYAxis=function(b){return arguments.length?(v=b,a):v},a.rightAlignYAxis=function(b){return arguments.length?(w=b,e.orient(b?"right":"left"),a):w},a.fisheye=function(b){return arguments.length?(y=b,a):y},a.xPadding=function(b){return arguments.length?(p=b,a):p},a.yPadding=function(b){return arguments.length?(q=b,a):q},a.tooltips=function(b){return arguments.length?(A=b,a):A},a.tooltipContent=function(b){return arguments.length?(D=b,a):D},a.tooltipXContent=function(b){return arguments.length?(B=b,a):B},a.tooltipYContent=function(b){return arguments.length?(C=b,a):C},a.state=function(b){return arguments.length?(E=b,a):E},a.defaultState=function(b){return arguments.length?(F=b,a):F},a.noData=function(b){return arguments.length?(H=b,a):H},a.transitionDuration=function(b){return arguments.length?(I=b,a):I},a},c.models.scatterPlusLineChart=function(){"use strict";function a(c){return c.each(function(c){function z(){if(x)return S.select(".nv-point-paths").style("pointer-events","all"),!1;S.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);n.distortion(w).focus(a[0]),o.distortion(w).focus(a[1]),S.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),s&&S.select(".nv-x.nv-axis").call(d),t&&S.select(".nv-y.nv-axis").call(e),S.select(".nv-distributionX").datum(c.filter(function(a){return!a.disabled})).call(h),S.select(".nv-distributionY").datum(c.filter(function(a){return!a.disabled})).call(i)}var A=d3.select(this),B=this,L=(k||parseInt(A.style("width"))||960)-j.left-j.right,M=(l||parseInt(A.style("height"))||400)-j.top-j.bottom;if(a.update=function(){A.transition().duration(G).call(a)},a.container=this,C.disabled=c.map(function(a){return!!a.disabled}),!D){var N;D={};for(N in C)D[N]=C[N]instanceof Array?C[N].slice(0):C[N]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var O=A.selectAll(".nv-noData").data([F]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",j.left+L/2).attr("y",j.top+M/2).text(function(a){return a}),a}A.selectAll(".nv-noData").remove(),n=b.xScale(),o=b.yScale(),H=H||n,I=I||o;var P=A.selectAll("g.nv-wrap.nv-scatterChart").data([c]),Q=P.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),R=Q.append("g"),S=P.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),P.attr("transform","translate("+j.left+","+j.top+")"),u&&S.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),r&&(f.width(L/2),P.select(".nv-legendWrap").datum(c).call(f),j.top!=f.height()&&(j.top=f.height(),M=(l||parseInt(A.style("height"))||400)-j.top-j.bottom),P.select(".nv-legendWrap").attr("transform","translate("+L/2+","+-j.top+")")),v&&(g.width(180).color(["#444"]),S.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+-j.top+")").call(g)),b.width(L).height(M).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),P.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),P.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var T=P.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a});T.enter().append("g").attr("class","nv-regLines");{var U=T.selectAll(".nv-regLine").data(function(a){return[a]});U.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0)}U.transition().attr("x1",n.range()[0]).attr("x2",n.range()[1]).attr("y1",function(a){return o(n.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a){return o(n.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return m(a,c)}).style("stroke-opacity",function(a){return a.disabled||"undefined"==typeof a.slope||"undefined"==typeof a.intercept?0:1}),s&&(d.scale(n).ticks(d.ticks()?d.ticks():L/100).tickSize(-M,0),S.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")").call(d)),t&&(e.scale(o).ticks(e.ticks()?e.ticks():M/36).tickSize(-L,0),S.select(".nv-y.nv-axis").call(e)),p&&(h.getData(b.x()).scale(n).width(L).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),S.select(".nv-distributionX").attr("transform","translate(0,"+o.range()[0]+")").datum(c.filter(function(a){return!a.disabled})).call(h)),q&&(i.getData(b.y()).scale(o).width(M).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),S.select(".nv-distributionY").attr("transform","translate("+(u?L:-i.size())+",0)").datum(c.filter(function(a){return!a.disabled})).call(i)),d3.fisheye&&(S.select(".nv-background").attr("width",L).attr("height",M),S.select(".nv-background").on("mousemove",z),S.select(".nv-background").on("click",function(){x=!x}),b.dispatch.on("elementClick.freezeFisheye",function(){x=!x})),g.dispatch.on("legendClick",function(c){c.disabled=!c.disabled,w=c.disabled?0:2.5,S.select(".nv-background").style("pointer-events",c.disabled?"none":"all"),S.select(".nv-point-paths").style("pointer-events",c.disabled?"all":"none"),c.disabled?(n.distortion(w).focus(0),o.distortion(w).focus(0),S.select(".nv-scatterWrap").call(b),S.select(".nv-x.nv-axis").call(d),S.select(".nv-y.nv-axis").call(e)):x=!1,a.update()}),f.dispatch.on("stateChange",function(b){C=b,E.stateChange(C),a.update()}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-M),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+h.size()),a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],E.tooltipShow(a)}),E.on("tooltipShow",function(a){y&&J(a,B.parentNode)}),E.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),C.disabled=b.disabled),a.update()}),H=n.copy(),I=o.copy()}),a}var b=c.models.scatter(),d=c.models.axis(),e=c.models.axis(),f=c.models.legend(),g=c.models.legend(),h=c.models.distribution(),i=c.models.distribution(),j={top:30,right:20,bottom:50,left:75},k=null,l=null,m=c.utils.defaultColor(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),o=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),p=!1,q=!1,r=!0,s=!0,t=!0,u=!1,v=!!d3.fisheye,w=0,x=!1,y=!0,z=function(a,b){return""+b+""},A=function(a,b,c){return""+c+""},B=function(a,b,c,d){return"

"+a+"

"+d+"

"},C={},D=null,E=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),F="No Data Available.",G=250;b.xScale(n).yScale(o),d.orient("bottom").tickPadding(10),e.orient(u?"right":"left").tickPadding(10),h.axis("x"),i.axis("y"),g.updateState(!1);var H,I,J=function(f,g){var h=f.pos[0]+(g.offsetLeft||0),i=f.pos[1]+(g.offsetTop||0),k=f.pos[0]+(g.offsetLeft||0),l=o.range()[0]+j.top+(g.offsetTop||0),m=n.range()[0]+j.left+(g.offsetLeft||0),p=f.pos[1]+(g.offsetTop||0),q=d.tickFormat()(b.x()(f.point,f.pointIndex)),r=e.tickFormat()(b.y()(f.point,f.pointIndex));null!=z&&c.tooltip.show([k,l],z(f.series.key,q,r,f,a),"n",1,g,"x-nvtooltip"),null!=A&&c.tooltip.show([m,p],A(f.series.key,q,r,f,a),"e",1,g,"y-nvtooltip"),null!=B&&c.tooltip.show([h,i],B(f.series.key,q,r,f.point.tooltip,f,a),f.value<0?"n":"s",null,g)},K=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){E.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",i.size())}),E.on("tooltipHide",function(){y&&c.tooltip.cleanup()}),a.dispatch=E,a.scatter=b,a.legend=f,a.controls=g,a.xAxis=d,a.yAxis=e,a.distX=h,a.distY=i,d3.rebind(a,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),f.color(m),h.color(m),i.color(m),a):m},a.showDistX=function(b){return arguments.length?(p=b,a):p},a.showDistY=function(b){return arguments.length?(q=b,a):q},a.showControls=function(b){return arguments.length?(v=b,a):v},a.showLegend=function(b){return arguments.length?(r=b,a):r},a.showXAxis=function(b){return arguments.length?(s=b,a):s},a.showYAxis=function(b){return arguments.length?(t=b,a):t},a.rightAlignYAxis=function(b){return arguments.length?(u=b,e.orient(b?"right":"left"),a):u},a.fisheye=function(b){return arguments.length?(w=b,a):w},a.tooltips=function(b){return arguments.length?(y=b,a):y},a.tooltipContent=function(b){return arguments.length?(B=b,a):B},a.tooltipXContent=function(b){return arguments.length?(z=b,a):z},a.tooltipYContent=function(b){return arguments.length?(A=b,a):A},a.state=function(b){return arguments.length?(C=b,a):C},a.defaultState=function(b){return arguments.length?(D=b,a):D},a.noData=function(b){return arguments.length?(F=b,a):F},a.transitionDuration=function(b){return arguments.length?(G=b,a):G},a},c.models.sparkline=function(){"use strict";function a(c){return c.each(function(a){var c=h-g.left-g.right,j=i-g.top-g.bottom,p=d3.select(this);k.domain(b||d3.extent(a,m)).range(e||[0,c]),l.domain(d||d3.extent(a,n)).range(f||[j,0]);{var q=p.selectAll("g.nv-wrap.nv-sparkline").data([a]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");r.append("g"),q.select("g")}q.attr("transform","translate("+g.left+","+g.top+")");var s=q.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||o(a,b)}).attr("d",d3.svg.line().x(function(a,b){return k(m(a,b))}).y(function(a,b){return l(n(a,b))}));var t=q.selectAll("circle.nv-point").data(function(a){function b(b){if(-1!=b){var c=a[b];return c.pointIndex=b,c}return null}var c=a.map(function(a,b){return n(a,b)}),d=b(c.lastIndexOf(l.domain()[1])),e=b(c.indexOf(l.domain()[0])),f=b(c.length-1);return[e,d,f].filter(function(a){return null!=a})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a){return k(m(a,a.pointIndex))}).attr("cy",function(a){return l(n(a,a.pointIndex))}).attr("r",2).attr("class",function(a){return m(a,a.pointIndex)==k.domain()[1]?"nv-point nv-currentValue":n(a,a.pointIndex)==l.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),a}var b,d,e,f,g={top:2,right:0,bottom:2,left:0},h=400,i=32,j=!0,k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=c.utils.getColor(["#000"]);return a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.x=function(b){return arguments.length?(m=d3.functor(b),a):m},a.y=function(b){return arguments.length?(n=d3.functor(b),a):n},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.animate=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(o=c.utils.getColor(b),a):o},a},c.models.sparklinePlus=function(){"use strict";function a(c){return c.each(function(m){function q(){if(!j){var a=A.selectAll(".nv-hoverValue").data(i),c=a.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);a.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),a.attr("transform",function(a){return"translate("+b(e.x()(m[a],a))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),i.length&&(c.append("line").attr("x1",0).attr("y1",-f.top).attr("x2",0).attr("y2",u),c.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-f.top).attr("text-anchor","end").attr("dy",".9em"),A.select(".nv-hoverValue .nv-xValue").text(k(e.x()(m[i[0]],i[0]))),c.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-f.top).attr("text-anchor","start").attr("dy",".9em"),A.select(".nv-hoverValue .nv-yValue").text(l(e.y()(m[i[0]],i[0]))))}}function r(){function a(a,b){for(var c=Math.abs(e.x()(a[0],0)-b),d=0,f=0;fc;++c){for(b=0,d=0;bb;b++)a[b][c][1]/=d;else for(b=0;e>b;b++)a[b][c][1]=g}for(c=0;f>c;++c)h[c]=0;return h}}),a}var b,d,e={top:0,right:0,bottom:0,left:0},f=960,g=500,h=c.utils.defaultColor(),i=Math.floor(1e5*Math.random()),j=function(a){return a.x},k=function(a){return a.y},l="stack",m="zero",n="default",o="linear",p=!1,q=c.models.scatter(),r=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return q.size(2.2).sizeDomain([2.2,2.2]),q.dispatch.on("elementClick.area",function(a){r.areaClick(a)}),q.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],r.tooltipShow(a)}),q.dispatch.on("elementMouseout.tooltip",function(a){r.tooltipHide(a)}),a.dispatch=r,a.scatter=q,d3.rebind(a,q,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(j=d3.functor(b),a):j},a.y=function(b){return arguments.length?(k=d3.functor(b),a):k},a.margin=function(b){return arguments.length?(e.top="undefined"!=typeof b.top?b.top:e.top,e.right="undefined"!=typeof b.right?b.right:e.right,e.bottom="undefined"!=typeof b.bottom?b.bottom:e.bottom,e.left="undefined"!=typeof b.left?b.left:e.left,a):e},a.width=function(b){return arguments.length?(f=b,a):f},a.height=function(b){return arguments.length?(g=b,a):g},a.clipEdge=function(b){return arguments.length?(p=b,a):p},a.color=function(b){return arguments.length?(h=c.utils.getColor(b),a):h},a.offset=function(b){return arguments.length?(m=b,a):m},a.order=function(b){return arguments.length?(n=b,a):n},a.style=function(b){if(!arguments.length)return l;switch(l=b){case"stack":a.offset("zero"),a.order("default");break;case"stream":a.offset("wiggle"),a.order("inside-out");break;case"stream-center":a.offset("silhouette"),a.order("inside-out");break;case"expand":a.offset("expand"),a.order("default");break;case"stack_percent":a.offset(a.d3_stackedOffset_stackPercent),a.order("default")}return a},a.interpolate=function(b){return arguments.length?(o=b,a):o},a},c.models.stackedAreaChart=function(){"use strict";function a(v){return v.each(function(v){var G=d3.select(this),H=this,I=(l||parseInt(G.style("width"))||960)-k.left-k.right,J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom;if(a.update=function(){G.transition().duration(E).call(a)},a.container=this,x.disabled=v.map(function(a){return!!a.disabled}),!y){var K;y={};for(K in x)y[K]=x[K]instanceof Array?x[K].slice(0):x[K]}if(!(v&&v.length&&v.filter(function(a){return a.values.length}).length)){var L=G.selectAll(".nv-noData").data([z]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",k.left+I/2).attr("y",k.top+J/2).text(function(a){return a}),a}G.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var M=G.selectAll("g.nv-wrap.nv-stackedAreaChart").data([v]),N=M.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),O=M.select("g");if(N.append("rect").style("opacity",0),N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis"),N.append("g").attr("class","nv-stackedWrap"),N.append("g").attr("class","nv-legendWrap"),N.append("g").attr("class","nv-controlsWrap"),N.append("g").attr("class","nv-interactive"),O.select("rect").attr("width",I).attr("height",J),p){var P=o?I-B:I;h.width(P),O.select(".nv-legendWrap").datum(v).call(h),k.top!=h.height()&&(k.top=h.height(),J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom),O.select(".nv-legendWrap").attr("transform","translate("+(I-P)+","+-k.top+")")}if(o){var Q=[{key:D.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=e.style(),style:"stack"},{key:D.stream||"Stream",metaKey:"Stream",disabled:"stream"!=e.style(),style:"stream"},{key:D.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=e.style(),style:"expand"},{key:D.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=e.style(),style:"stack_percent"}];B=C.length/3*260,Q=Q.filter(function(a){return-1!==C.indexOf(a.metaKey)}),i.width(B).color(["#444","#444","#444"]),O.select(".nv-controlsWrap").datum(Q).call(i),k.top!=Math.max(i.height(),h.height())&&(k.top=Math.max(i.height(),h.height()),J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom),O.select(".nv-controlsWrap").attr("transform","translate(0,"+-k.top+")")}M.attr("transform","translate("+k.left+","+k.top+")"),s&&O.select(".nv-y.nv-axis").attr("transform","translate("+I+",0)"),t&&(j.width(I).height(J).margin({left:k.left,top:k.top}).svgContainer(G).xScale(b),M.select(".nv-interactive").call(j)),e.width(I).height(J);var R=O.select(".nv-stackedWrap").datum(v);R.transition().call(e),q&&(f.scale(b).ticks(I/100).tickSize(-J,0),O.select(".nv-x.nv-axis").attr("transform","translate(0,"+J+")"),O.select(".nv-x.nv-axis").transition().duration(0).call(f)),r&&(g.scale(d).ticks("wiggle"==e.offset()?0:J/36).tickSize(-I,0).setTickFormat("expand"==e.style()||"stack_percent"==e.style()?d3.format("%"):w),O.select(".nv-y.nv-axis").transition().duration(0).call(g)),e.dispatch.on("areaClick.toggle",function(b){v.forEach(1===v.filter(function(a){return!a.disabled}).length?function(a){a.disabled=!1}:function(a,c){a.disabled=c!=b.seriesIndex}),x.disabled=v.map(function(a){return!!a.disabled}),A.stateChange(x),a.update()}),h.dispatch.on("stateChange",function(b){x.disabled=b.disabled,A.stateChange(x),a.update()}),i.dispatch.on("legendClick",function(b){b.disabled&&(Q=Q.map(function(a){return a.disabled=!0,a}),b.disabled=!1,e.style(b.style),x.style=e.style(),A.stateChange(x),a.update())}),j.dispatch.on("elementMousemove",function(b){e.clearHighlights(); var d,h,i,l=[];if(v.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,g){h=c.interactiveBisect(f.values,b.pointXValue,a.x()),e.highlightPoint(g,h,!0);var j=f.values[h];if("undefined"!=typeof j){"undefined"==typeof d&&(d=j),"undefined"==typeof i&&(i=a.xScale()(a.x()(j,h)));var k="expand"==e.style()?j.display.y:a.y()(j,h);l.push({key:f.key,value:k,color:n(f,f.seriesIndex),stackedValue:j.display})}}),l.reverse(),l.length>2){var m=a.yScale().invert(b.mouseY),o=null;l.forEach(function(a,b){m=Math.abs(m);var c=Math.abs(a.stackedValue.y0),d=Math.abs(a.stackedValue.y);return m>=c&&d+c>=m?void(o=b):void 0}),null!=o&&(l[o].highlight=!0)}var p=f.tickFormat()(a.x()(d,h)),q="expand"==e.style()?function(a){return d3.format(".1%")(a)}:function(a){return g.tickFormat()(a)};j.tooltip.position({left:i+k.left,top:b.mouseY+k.top}).chartContainer(H.parentNode).enabled(u).valueFormatter(q).data({value:p,series:l})(),j.renderGuideLine(i)}),j.dispatch.on("elementMouseout",function(){A.tooltipHide(),e.clearHighlights()}),A.on("tooltipShow",function(a){u&&F(a,H.parentNode)}),A.on("changeState",function(b){"undefined"!=typeof b.disabled&&v.length===b.disabled.length&&(v.forEach(function(a,c){a.disabled=b.disabled[c]}),x.disabled=b.disabled),"undefined"!=typeof b.style&&e.style(b.style),a.update()})}),a}var b,d,e=c.models.stackedArea(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i=c.models.legend(),j=c.interactiveGuideline(),k={top:30,right:25,bottom:50,left:60},l=null,m=null,n=c.utils.defaultColor(),o=!0,p=!0,q=!0,r=!0,s=!1,t=!1,u=!0,v=function(a,b,c){return"

"+a+"

"+c+" on "+b+"

"},w=d3.format(",.2f"),x={style:e.style()},y=null,z="No Data Available.",A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),B=250,C=["Stacked","Stream","Expanded"],D={},E=250;f.orient("bottom").tickPadding(7),g.orient(s?"right":"left"),i.updateState(!1);var F=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=v(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"n":"s",null,d)};return e.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+k.left,a.pos[1]+k.top],A.tooltipShow(a)}),e.dispatch.on("tooltipHide",function(a){A.tooltipHide(a)}),A.on("tooltipHide",function(){u&&c.tooltip.cleanup()}),a.dispatch=A,a.stacked=e,a.legend=h,a.controls=i,a.xAxis=f,a.yAxis=g,a.interactiveLayer=j,d3.rebind(a,e,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(k.top="undefined"!=typeof b.top?b.top:k.top,k.right="undefined"!=typeof b.right?b.right:k.right,k.bottom="undefined"!=typeof b.bottom?b.bottom:k.bottom,k.left="undefined"!=typeof b.left?b.left:k.left,a):k},a.width=function(b){return arguments.length?(l=b,a):l},a.height=function(b){return arguments.length?(m=b,a):m},a.color=function(b){return arguments.length?(n=c.utils.getColor(b),h.color(n),e.color(n),a):n},a.showControls=function(b){return arguments.length?(o=b,a):o},a.showLegend=function(b){return arguments.length?(p=b,a):p},a.showXAxis=function(b){return arguments.length?(q=b,a):q},a.showYAxis=function(b){return arguments.length?(r=b,a):r},a.rightAlignYAxis=function(b){return arguments.length?(s=b,g.orient(b?"right":"left"),a):s},a.useInteractiveGuideline=function(b){return arguments.length?(t=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):t},a.tooltip=function(b){return arguments.length?(v=b,a):v},a.tooltips=function(b){return arguments.length?(u=b,a):u},a.tooltipContent=function(b){return arguments.length?(v=b,a):v},a.state=function(b){return arguments.length?(x=b,a):x},a.defaultState=function(b){return arguments.length?(y=b,a):y},a.noData=function(b){return arguments.length?(z=b,a):z},a.transitionDuration=function(b){return arguments.length?(E=b,a):E},a.controlsData=function(b){return arguments.length?(C=b,a):C},a.controlLabels=function(b){return arguments.length?"object"!=typeof b?D:(D=b,a):D},g.setTickFormat=g.tickFormat,g.tickFormat=function(a){return arguments.length?(w=a,g):w},a}}();var CryptoJS=CryptoJS||function(a,b){var c={},d=c.lib={},e=d.Base=function(){function a(){}return{extend:function(b){a.prototype=this;var c=new a;return b&&c.mixIn(b),c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)}),c.init.prototype=c,c.$super=this,c},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=d.WordArray=e.extend({init:function(a,c){a=this.words=a||[],this.sigBytes=c!=b?c:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;e>f;f++){var g=c[f>>>2]>>>24-f%4*8&255;b[d+f>>>2]|=g<<24-(d+f)%4*8}else if(c.length>65535)for(var f=0;e>f;f+=4)b[d+f>>>2]=c[f>>>2];else b.push.apply(b,c);return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;b>d;d+=4)c.push(4294967296*a.random()|0);return new f.init(c,b)}}),g=c.enc={},h=g.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new f.init(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new f.init(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=(g.Base64={stringify:function(a){var b=a.words,c=a.sigBytes,d=this._map;a.clamp();for(var e=[],f=0;c>f;f+=3)for(var g=b[f>>>2]>>>24-f%4*8&255,h=b[f+1>>>2]>>>24-(f+1)%4*8&255,i=b[f+2>>>2]>>>24-(f+2)%4*8&255,j=g<<16|h<<8|i,k=0;4>k&&c>f+.75*k;k++)e.push(d.charAt(j>>>6*(3-k)&63));var l=d.charAt(64);if(l)for(;e.length%4;)e.push(l);return e.join("")},parse:function(a){var b=a.length,c=this._map,d=c.charAt(64);if(d){var e=a.indexOf(d);-1!=e&&(b=e)}for(var g=[],h=0,i=0;b>i;i++)if(i%4){var j=c.indexOf(a.charAt(i-1))<>>6-i%4*2;g[h>>>2]|=(j|k)<<24-h%4*8,h++}return f.create(g,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=4*g,i=e/h;i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0);var j=i*g,k=a.min(4*j,e);if(j){for(var l=0;j>l;l+=g)this._doProcessBlock(d,l);var m=d.splice(0,j);c.sigBytes-=k}return new f.init(m,k)},clone:function(){var a=e.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0})),l=d.Hasher=k.extend({cfg:e.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){k.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new m.HMAC.init(a,c).finalize(b)}}}),m=c.algo={},n=[],o=m.SHA1=l.extend({_doReset:function(){this._hash=new f.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],i=0;80>i;i++){if(16>i)n[i]=0|a[b+i];else{var j=n[i-3]^n[i-8]^n[i-14]^n[i-16];n[i]=j<<1|j>>>31}var k=(d<<5|d>>>27)+h+n[i];k+=20>i?(e&f|~e&g)+1518500249:40>i?(e^f^g)+1859775393:60>i?(e&f|e&g|f&g)-1894007588:(e^f^g)-899497514,h=g,g=f,f=e<<30|e>>>2,e=d,d=k}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0},_doFinalize:function(){var b=this._data,c=b.words,d=8*this._nDataBytes,e=8*b.sigBytes;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=a.floor(d/4294967296),c[(e+64>>>9<<4)+15]=d,b.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=l.clone.call(this);return a._hash=this._hash.clone(),a}});return c.SHA1=l._createHelper(o),c.HmacSHA1=l._createHmacHelper(o),c}(Math);!function(a){a.verbs={answered:{id:"http://adlnet.gov/expapi/verbs/answered",display:{"en-US":"answered"}},asked:{id:"http://adlnet.gov/expapi/verbs/asked",display:{"en-US":"asked"}},attempted:{id:"http://adlnet.gov/expapi/verbs/attempted",display:{"en-US":"attempted"}},attended:{id:"http://adlnet.gov/expapi/verbs/attended",display:{"en-US":"attended"}},commented:{id:"http://adlnet.gov/expapi/verbs/commented",display:{"en-US":"commented"}},completed:{id:"http://adlnet.gov/expapi/verbs/completed",display:{"en-US":"completed"}},exited:{id:"http://adlnet.gov/expapi/verbs/exited",display:{"en-US":"exited"}},experienced:{id:"http://adlnet.gov/expapi/verbs/experienced",display:{"en-US":"experienced"}},failed:{id:"http://adlnet.gov/expapi/verbs/failed",display:{"en-US":"failed"}},imported:{id:"http://adlnet.gov/expapi/verbs/imported",display:{"en-US":"imported"}},initialized:{id:"http://adlnet.gov/expapi/verbs/initialized",display:{"en-US":"initialized"}},interacted:{id:"http://adlnet.gov/expapi/verbs/interacted",display:{"en-US":"interacted"}},launched:{id:"http://adlnet.gov/expapi/verbs/launched",display:{"en-US":"launched"}},mastered:{id:"http://adlnet.gov/expapi/verbs/mastered",display:{"en-US":"mastered"}},passed:{id:"http://adlnet.gov/expapi/verbs/passed",display:{"en-US":"passed"}},preferred:{id:"http://adlnet.gov/expapi/verbs/preferred",display:{"en-US":"preferred"}},progressed:{id:"http://adlnet.gov/expapi/verbs/progressed",display:{"en-US":"progressed"}},registered:{id:"http://adlnet.gov/expapi/verbs/registered",display:{"en-US":"registered"}},responded:{id:"http://adlnet.gov/expapi/verbs/responded",display:{"en-US":"responded"}},resumed:{id:"http://adlnet.gov/expapi/verbs/resumed",display:{"en-US":"resumed"}},scored:{id:"http://adlnet.gov/expapi/verbs/scored",display:{"en-US":"scored"}},shared:{id:"http://adlnet.gov/expapi/verbs/shared",display:{"en-US":"shared"}},suspended:{id:"http://adlnet.gov/expapi/verbs/suspended",display:{"en-US":"suspended"}},terminated:{id:"http://adlnet.gov/expapi/verbs/terminated",display:{"en-US":"terminated"}},voided:{id:"http://adlnet.gov/expapi/verbs/voided",display:{"en-US":"voided"}}}}(window.ADL=window.ADL||{}),Date.prototype.toISOString||!function(){function a(a){var b=String(a);return 1===b.length&&(b="0"+b),b}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}(),function(a){function b(){try{return void 0!=this.lrs.endpoint&&""!=this.lrs.endpoint}catch(a){return!1}}function c(a){if(!c.debug)return!1;try{return console.log(a),!0}catch(b){return!1}}function d(a,b){for(var c in b){prop=b[c],console.log(c+" : "+prop);try{b[c].constructor==Object?a[c]=d(a[c],b[c]):(void 0==a&&(a=new Object),a[c]=b[c])}catch(e){void 0==a&&(a=new Object),a[c]=b[c]}}return a}function e(a){var b,c,e=["endpoint","auth","actor","registration","activity_id","grouping","activity_platform"],g=new Object;if(b=f(),void 0!==b){for(var h=0;h0&&(f.push(e.substr(g+1)),e=e.substr(0,g)),e=e+"?method="+a,null!==c)for(var h in c)f.push(h+"="+encodeURIComponent(c[h]));return null!==d&&f.push("content="+encodeURIComponent(d)),{method:"POST",url:e,headers:{},data:f.join("&")}}c.debug=!0;var i=function(){var a={};a.endpoint="http://localhost:8000/xapi/";try{a.auth="Basic "+toBase64("tom:1234")}catch(b){c("Exception in Config trying to encode auth: "+b)}return a}();XAPIWrapper=function(c,f){function g(b){var c=document.createElement("a");return c.href=b,c.protocol&&c.host?c.protocol+"//"+c.host:void a.XAPIWrapper.log("Couldn't create base url from endpoint: "+this.lrs.endpoint)}function h(a,b,c){a.auth="Basic "+toBase64(b+":"+c)}this.lrs=e(c),this.lrs.user&&this.lrs.password&&h(this.lrs,this.lrs.user,this.lrs.password),this.base=g(this.lrs.endpoint),f&&b.call(this)&&window.ADL.XHR_request(this.lrs,this.lrs.endpoint+"about","GET",null,null,function(b){if(200==b.status)try{var c=JSON.parse(b.response),d=!1;for(var e in c.version)if(c.version[e]==a.XAPIWrapper.xapiVersion){d=!0;break}d||a.XAPIWrapper.log("The lrs version ["+c.version+"] does not match this wrapper's XAPI version ["+a.XAPIWrapper.xapiVersion+"]")}catch(f){a.XAPIWrapper.log("The response was not an about object")}else a.XAPIWrapper.log("The request to get information about the LRS failed: "+b)}),this.searchParams=function(){var a={format:"exact"};return a},this.hash=function(b){if(!b)return null;try{return toSHA1(b)}catch(c){return a.XAPIWrapper.log("Error trying to hash -- "+c),null}},this.changeConfig=function(b){try{a.XAPIWrapper.log("updating lrs object with new configuration"),this.lrs=d(this.lrs,b),b.user&&b.password&&this.updateAuth(this.lrs,b.user,b.password),this.base=g(this.lrs.endpoint)}catch(c){a.XAPIWrapper.log("error while changing configuration -- "+c)}},this.updateAuth=h},XAPIWrapper.prototype.xapiVersion="1.0.1",XAPIWrapper.prototype.build="2014-02-25T14:00Z",XAPIWrapper.prototype.prepareStatement=function(a){void 0===a.actor?a.actor=JSON.parse(this.lrs.actor):"string"==typeof a.actor&&(a.actor=JSON.parse(a.actor)),(this.lrs.grouping||this.lrs.registration||this.lrs.activity_platform)&&(a.context||(a.context={})),this.lrs.grouping&&(a.context.contextActivities||(a.context.contextActivities={}),a.context.contextActivities.grouping=[{id:this.lrs.grouping}]),this.lrs.registration&&(a.context.registration=this.lrs.registration),this.lrs.activity_platform&&(a.context.platform=this.lrs.activity_platform)},XAPIWrapper.prototype.testConfig=b,XAPIWrapper.prototype.log=c,XAPIWrapper.prototype.sendStatement=function(b,c){if(this.testConfig()){this.prepareStatement(b);var d;b.id?d=b.id:(d=a.ruuid(),b.id=d);var e=a.XHR_request(this.lrs,this.lrs.endpoint+"statements","POST",JSON.stringify(b),this.lrs.auth,c,{id:d});if(!c)return{xhr:e,id:d}}},XAPIWrapper.prototype.sendStatements=function(b,c){if(this.testConfig()){for(var d in b)this.prepareStatement(b[d]);var e=a.XHR_request(this.lrs,this.lrs.endpoint+"statements","POST",JSON.stringify(b),this.lrs.auth,c);if(!c)return e}},XAPIWrapper.prototype.getStatements=function(b,c,d){if(this.testConfig()){var e=this.lrs.endpoint+"statements";if(c)e=this.base+c;else{var f=new Array;for(s in b)f.push(s+"="+encodeURIComponent(b[s]));f.length>0&&(e=e+"?"+f.join("&"))}var g=a.XHR_request(this.lrs,e,"GET",null,this.lrs.auth,d);if(void 0===g||404==g.status)return null;try{return JSON.parse(g.response)}catch(h){return g.response}}},XAPIWrapper.prototype.getActivities=function(b,c){if(this.testConfig()){var d=this.lrs.endpoint+"activities?activityId=";d=d.replace("",encodeURIComponent(b));var e=a.XHR_request(this.lrs,d,"GET",null,this.lrs.auth,c,null,!0);if(void 0===e||404==e.status)return null;try{return JSON.parse(e.response)}catch(f){return e.response}}},XAPIWrapper.prototype.sendState=function(b,d,e,f,g,h,i,j){if(this.testConfig()){var k=this.lrs.endpoint+"activities/state?activityId=&agent=&stateId=";k=k.replace("",encodeURIComponent(b)),k=k.replace("",encodeURIComponent(JSON.stringify(d))),k=k.replace("",encodeURIComponent(e)),f&&(k+="®istration="+encodeURIComponent(f));var l=null;h&&i?c("Can't have both If-Match and If-None-Match"):h?l={"If-Match":'"'+h+'"'}:i&&(l={"If-None-Match":'"'+i+'"'});var m="PUT";if(!g)return this.log("No activity state was included."),!1;g instanceof Array?(g=JSON.stringify(g),l=l||{},l["Content-Type"]="application/json"):g instanceof Object?(g=JSON.stringify(g),l=l||{},l["Content-Type"]="application/json",m="POST"):(l=l||{},l["Content-Type"]="application/octect-stream"),a.XHR_request(this.lrs,k,m,g,this.lrs.auth,j,null,null,l)}},XAPIWrapper.prototype.getState=function(b,c,d,e,f,g){if(this.testConfig()){var h=this.lrs.endpoint+"activities/state?activityId=&agent=";h=h.replace("",encodeURIComponent(b)),h=h.replace("",encodeURIComponent(JSON.stringify(c))),d&&(h+="&stateId="+encodeURIComponent(d)),e&&(h+="®istration="+encodeURIComponent(e)),f&&(h+="&since="+encodeURIComponent(f.toISOString()));var i=a.XHR_request(this.lrs,h,"GET",null,this.lrs.auth,g,null,!0);if(void 0===i||404==i.status)return null;try{return JSON.parse(i.response)}catch(j){return i.response}}},XAPIWrapper.prototype.sendActivityProfile=function(b,d,e,f,g,h){if(this.testConfig()){var i=this.lrs.endpoint+"activities/profile?activityId=&profileId=";i=i.replace("",encodeURIComponent(b)),i=i.replace("",encodeURIComponent(d));var j=null;f&&g?c("Can't have both If-Match and If-None-Match"):f?j={"If-Match":'"'+f+'"'}:g&&(j={"If-None-Match":'"'+g+'"'});var k="PUT";if(!e)return this.log("No activity profile was included."),!1;e instanceof Array?(e=JSON.stringify(e),j=j||{},j["Content-Type"]="application/json"):e instanceof Object?(e=JSON.stringify(e),j=j||{},j["Content-Type"]="application/json",k="POST"):(j=j||{},j["Content-Type"]="application/octect-stream"),a.XHR_request(this.lrs,i,k,e,this.lrs.auth,h,null,!1,j)}},XAPIWrapper.prototype.getActivityProfile=function(b,c,d,e){if(this.testConfig()){var f=this.lrs.endpoint+"activities/profile?activityId=";f=f.replace("",encodeURIComponent(b)),c&&(f+="&profileId="+encodeURIComponent(c)),d&&(f+="&since="+encodeURIComponent(d.toISOString()));var g=a.XHR_request(this.lrs,f,"GET",null,this.lrs.auth,e,null,!0);if(void 0===g||404==g.status)return null;try{return JSON.parse(g.response)}catch(h){return g.response}}},XAPIWrapper.prototype.getAgents=function(b,c){if(this.testConfig()){var d=this.lrs.endpoint+"agents?agent=";d=d.replace("",encodeURIComponent(JSON.stringify(b)));var e=a.XHR_request(this.lrs,d,"GET",null,this.lrs.auth,c,null,!0);if(void 0===e||404==e.status)return null;try{return JSON.parse(e.response)}catch(f){return e.response}}},XAPIWrapper.prototype.sendAgentProfile=function(b,d,e,f,g,h){if(this.testConfig()){var i=this.lrs.endpoint+"agents/profile?agent=&profileId=";i=i.replace("",encodeURIComponent(JSON.stringify(b))),i=i.replace("",encodeURIComponent(d));var j=null;f&&g?c("Can't have both If-Match and If-None-Match"):f?j={"If-Match":'"'+f+'"'}:g&&(j={"If-None-Match":'"'+g+'"'});var k="PUT";if(!e)return this.log("No agent profile was included."),!1;e instanceof Array?(e=JSON.stringify(e),j=j||{},j["Content-Type"]="application/json"):e instanceof Object?(e=JSON.stringify(e),j=j||{},j["Content-Type"]="application/json",k="POST"):(j=j||{},j["Content-Type"]="application/octect-stream"),a.XHR_request(this.lrs,i,k,e,this.lrs.auth,h,null,!1,j)}},XAPIWrapper.prototype.getAgentProfile=function(b,c,d,e){if(this.testConfig()){var f=this.lrs.endpoint+"agents/profile?agent=";f=f.replace("",encodeURIComponent(JSON.stringify(b))),f=f.replace("",encodeURIComponent(c)),c&&(f+="&profileId="+encodeURIComponent(c)),d&&(f+="&since="+encodeURIComponent(d.toISOString()));var g=a.XHR_request(this.lrs,f,"GET",null,this.lrs.auth,e,null,!0);if(void 0===g||404==g.status)return null;try{return JSON.parse(g.response)}catch(h){return g.response}}},a.ruuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})},a.dateFromISOString=function(a){var b="([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T| ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?",c=a.match(new RegExp(b)),d=0,e=new Date(c[1],0,1);c[3]&&e.setMonth(c[3]-1),c[5]&&e.setDate(c[5]),c[7]&&e.setHours(c[7]),c[8]&&e.setMinutes(c[8]),c[10]&&e.setSeconds(c[10]),c[12]&&e.setMilliseconds(1e3*Number("0."+c[12])),c[14]&&(d=60*Number(c[16])+Number(c[17]),d*="-"==c[15]?1:-1),d-=e.getTimezoneOffset(),time=Number(e)+60*d*1e3;var f=new Date;return f.setTime(Number(time)),f},a.XHR_request=function(b,c,d,e,f,i,j,k,l){"use strict";function m(){if(s)return q;s=!0;var a=k&&404===n.status;if(!(void 0===n.status||n.status>=200&&n.status<400||a)){try{alert("There was a problem communicating with the Learning Record Store. ( "+n.status+" | "+n.response+" )"+n.url)}catch(b){alert(b.toString())}return q=n,n}if(!i)return q=n,n;if(j)i(n,j);else try{var c=JSON.parse(n.responseText);i(n,c)}catch(d){i(n,n.responseText)}}var n,o,p,q,r,s=!1,t=!1,u=!1,v=c.toLowerCase().match(/^(.+):\/\/([^:\/]*):?(\d+)?(\/.*)?$/),w=window.location,x={};if(x["Content-Type"]="application/json",x.Authorization=f,x["X-Experience-API-Version"]=a.XAPIWrapper.xapiVersion,null!==l)for(var y in l)x[y]=l[y];if(t=w.protocol.toLowerCase()!==v[1]||w.hostname.toLowerCase()!==v[2],t||(p=null===v[3]?"http"===v[1]?"80":"443":v[3],t=p===w.port),t&&"undefined"!=typeof XDomainRequest)u=!0,o=h(d,c,x,e),n=new XDomainRequest,n.open(o.method,o.url);else{n=new XMLHttpRequest,n.open(d,c,null!=i);for(var y in x)n.setRequestHeader(y,x[y])}if(n.onreadystatechange=function(){return 4===n.readyState?m():void 0},n.onload=m,n.onerror=m,n.send(u?o.data:e),!i){if(u)for(r=1e3+new Date;new Date=0?""+e[h].values[g].in+"":""+c.groupBy+"";h=0?""+e[h].values[g].out+"":""+e[h].key+"";f+=""}else{f+=""+c.groupBy+""+c.xpath+"";for(var g=0;g"+e[g].in+""+e[g].out+""}f+="",a.$(b).innerHTML=f},c.data=c.data.save(),c.pre&&("string"==typeof c.pre?c.data.where(c.pre):c.pre(c.data,d)),void c.aggregate(c,d)):void console.error("Must specify aggregate function, chartType, and container before drawing chart",c)},a.Chart=b,a.BarChart=c,a.LineChart=d,a.MultiBarChart=f,a.PieChart=e,a.LinePlusBarChart=g,a.Table=h}(window.ADL=window.ADL||{}); \ No newline at end of file +}}(window.ADL=window.ADL||{}),nv.models.multiBar=function(){"use strict";function a(A){return A.each(function(a){var A=j-i.left-i.right,B=k-i.top-i.bottom,C=d3.select(this);v&&a.length&&(v=[{values:a[0].values.map(function(a){return{x:a.x,y:0,series:a.series,size:.01}})}]),s&&(a=d3.layout.stack().offset(t).values(function(a){return a.values}).y(p)(!a.length&&v?v:a)),a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})}),s&&a[0].values.map(function(b,c){var d=0,e=0;a.map(function(a){var b=a.values[c];b.size=Math.abs(b.y),b.y<0?(b.y1=e,e-=b.size):(b.y1=b.size+d,d+=b.size)})});var D=c&&d?[]:a.map(function(a){return a.values.map(function(a,b){return{x:o(a,b),y:p(a,b),y0:a.y0,y1:a.y1}})});l.domain(c||d3.merge(D).map(function(a){return a.x})).rangeBands(e||[0,A],y),m.domain(d||d3.extent(d3.merge(D).map(function(a){return a.y}).concat(q))).range(f||[B,0]),l.domain()[0]===l.domain()[1]&&l.domain(l.domain()[0]?[l.domain()[0]-.01*l.domain()[0],l.domain()[1]+.01*l.domain()[1]]:[-1,1]),m.domain()[0]===m.domain()[1]&&m.domain(m.domain()[0]?[m.domain()[0]+.01*m.domain()[0],m.domain()[1]-.01*m.domain()[1]]:[-1,1]),g=g||l,h=h||m;var E=C.selectAll("g.nv-wrap.nv-multibar").data([a]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),G=F.append("defs"),H=F.append("g"),I=E.select("g");H.append("g").attr("class","nv-groups"),E.attr("transform","translate("+i.left+","+i.top+")"),G.append("clipPath").attr("id","nv-edge-clip-"+n).append("rect"),E.select("#nv-edge-clip-"+n+" rect").attr("width",A).attr("height",B),I.attr("clip-path",r?"url(#nv-edge-clip-"+n+")":"");var J=E.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a,b){return b});J.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),J.exit().transition().selectAll("rect.nv-bar").delay(function(b,c){return c*x/a[0].values.length}).attr("y",function(a){return h(s?a.y0:0)}).attr("height",0).remove(),J.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return u(a,b)}).style("stroke",function(a,b){return u(a,b)}),J.transition().style("stroke-opacity",1).style("fill-opacity",.75);var K=J.selectAll("rect.nv-bar").data(function(b){return v&&!a.length?v.values:b.values});K.exit().remove();K.enter().append("rect").attr("class",function(a,b){return p(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return s?0:d*l.rangeBand()/a.length}).attr("y",function(a){return h(s?a.y0:0)}).attr("height",0).attr("width",l.rangeBand()/(s?1:a.length)).attr("transform",function(a,b){return"translate("+l(o(a,b))+",0)"});K.style("fill",function(a,b,c){return u(a,c,b)}).style("stroke",function(a,b,c){return u(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),z.elementMouseover({value:p(b,c),point:b,series:a[b.series],pos:[l(o(b,c))+l.rangeBand()*(s?a.length/2:b.series+.5)/a.length,m(p(b,c)+(s?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),z.elementMouseout({value:p(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){z.elementClick({value:p(b,c),point:b,series:a[b.series],pos:[l(o(b,c))+l.rangeBand()*(s?a.length/2:b.series+.5)/a.length,m(p(b,c)+(s?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){z.elementDblClick({value:p(b,c),point:b,series:a[b.series],pos:[l(o(b,c))+l.rangeBand()*(s?a.length/2:b.series+.5)/a.length,m(p(b,c)+(s?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),K.attr("class",function(a,b){return p(a,b)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(a,b){return"translate("+l(o(a,b))+",0)"}),w&&(b||(b=a.map(function(){return!0})),K.style("fill",function(a,c,d){return d3.rgb(w(a,c)).darker(b.map(function(a,b){return b}).filter(function(a,c){return!b[c]})[d]).toString()}).style("stroke",function(a,c,d){return d3.rgb(w(a,c)).darker(b.map(function(a,b){return b}).filter(function(a,c){return!b[c]})[d]).toString()})),s?K.transition().delay(function(b,c){return c*x/a[0].values.length}).attr("height",function(a){return Math.max(Math.abs(m(a.y+(s?a.y0:0))-m(s?a.y0:0)),1)}).attr("x",function(b){return s?0:b.series*l.rangeBand()/a.length}).attr("y",function(a,b){return p(a,b)<0?m(0):m(0)-m(p(a,b))<1?m(0)-1:m(p(a,b))||0}).attr("height",function(a,b){return Math.max(Math.abs(m(p(a,b))-m(0)),1)||0}):K.transition().delay(function(b,c){return c*x/a[0].values.length}).attr("x",function(b){return b.series*l.rangeBand()/a.length}).attr("width",l.rangeBand()/a.length).attr("y",function(a,b){return p(a,b)<0?m(0):m(0)-m(p(a,b))<1?m(0)-1:m(p(a,b))||0}).attr("height",function(a,b){return Math.max(Math.abs(m(p(a,b))-m(0)),1)||0}),g=l.copy(),h=m.copy()}),a}var b,c,d,e,f,g,h,i={top:0,right:0,bottom:0,left:0},j=960,k=500,l=d3.scale.ordinal(),m=d3.scale.linear(),n=Math.floor(1e4*Math.random()),o=function(a){return a.x},p=function(a){return a.y},q=[0],r=!0,s=!0,t="zero",u=nv.utils.defaultColor(),v=!1,w=null,x=1200,y=.1,z=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=z,a.options=nv.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=b,a):o},a.y=function(b){return arguments.length?(p=b,a):p},a.margin=function(b){return arguments.length?(i.top="undefined"!=typeof b.top?b.top:i.top,i.right="undefined"!=typeof b.right?b.right:i.right,i.bottom="undefined"!=typeof b.bottom?b.bottom:i.bottom,i.left="undefined"!=typeof b.left?b.left:i.left,a):i},a.width=function(b){return arguments.length?(j=b,a):j},a.height=function(b){return arguments.length?(k=b,a):k},a.xScale=function(b){return arguments.length?(l=b,a):l},a.yScale=function(b){return arguments.length?(m=b,a):m},a.xDomain=function(b){return arguments.length?(c=b,a):c},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceY=function(b){return arguments.length?(q=b,a):q},a.stacked=function(b){return arguments.length?(s=b,a):s},a.stackOffset=function(b){return arguments.length?(t=b,a):t},a.clipEdge=function(b){return arguments.length?(r=b,a):r},a.color=function(b){return arguments.length?(u=nv.utils.getColor(b),a):u},a.barColor=function(b){return arguments.length?(w=nv.utils.getColor(b),a):w},a.disabled=function(c){return arguments.length?(b=c,a):b},a.id=function(b){return arguments.length?(n=b,a):n},a.hideable=function(b){return arguments.length?(v=b,a):v},a.delay=function(b){return arguments.length?(x=b,a):x},a.groupSpacing=function(b){return arguments.length?(y=b,a):y},a},function(a){function b(a){this.opts=a||{},this.opts.child&&(this.child=a.child,this.opts.child.parent=this)}function c(c){b.call(this,c),this.opts.chartType="discreteBarChart",this.opts.eventChartType="discretebar",this.opts.aggregate=this.opts.aggregate?this.opts.aggregate:a.count(),this.opts.nvd3Opts=this.opts.nvd3Opts?this.opts.nvd3Opts:{x:function(a){return a.in},y:function(a){return a.out},staggerLabels:!0,transitionDuration:250,margin:{left:80,bottom:100}}}function d(a){b.call(this,a),this.opts.chartType="lineChart",this.opts.nvd3Opts=this.opts.nvd3Opts?this.opts.nvd3Opts:{x:function(a){return a.in},y:function(a){return a.out},showXAxis:!0,showYAxis:!0,showLegend:!1,transitionDuration:250,margin:{left:80,bottom:100}}}function e(c){b.call(this,c),this.opts.chartType="pieChart",this.opts.eventChartType="pie",this.opts.aggregate=this.opts.aggregate?this.opts.aggregate:a.count(),this.opts.nvd3Opts=this.opts.nvd3Opts?this.opts.nvd3Opts:{x:function(a){return a.in},y:function(a){return a.out},transitionDuration:250,color:d3.scale.category20().range()}}function f(c){b.call(this,c),this.opts.chartType="multiBarChart",this.opts.eventChartType="multibar",this.opts.aggregate=this.opts.aggregate?this.opts.aggregate:a.count(),this.opts.nvd3Opts=this.opts.nvd3Opts?this.opts.nvd3Opts:{x:function(a){return a.in},y:function(a){return a.out},showXAxis:!0,showYAxis:!0,transitionDuration:250,groupSpacing:.25,showControls:!1,margin:{left:80,bottom:100}}}function g(c){b.call(this,c),this.opts.chartType="linePlusBarChart",this.opts.aggregate=this.opts.aggregate?this.opts.aggregate:a.count(),this.opts.nvd3Opts=this.opts.nvd3Opts?this.opts.nvd3Opts:{x:function(a){return console.log(a.in.split("-")[0]),a.in.split("-")[0]},y:function(a){return console.log(a.out?a.out:0),a.out?a.out:0},showXAxis:!0,showYAxis:!0,transitionDuration:250,margin:{top:30,right:60,bottom:50,left:70}}}function h(c){b.call(this,c),this.opts.chartType="table",this.opts.aggregate=this.opts.aggregate?this.opts.aggregate:a.count()}b.prototype.pipeData=function(a,b){d3.select(this.opts.container).datum([{values:a}]).call(b)},b.prototype.clear=function(b){for(var c=a.$(b?b:this.opts.container);c.firstChild;)c.removeChild(c.firstChild);if(this.child instanceof Array)for(var d=0;d=0?""+e[h].values[g].in+"":""+c.groupBy+"";h=0?""+e[h].values[g].out+"":""+e[h].key+"";f+=""}else{f+=""+c.groupBy+""+c.xpath+"";for(var g=0;g"+e[g].in+""+e[g].out+""}f+="",a.$(b).innerHTML=f},c.data=c.data.save(),c.pre&&("string"==typeof c.pre?c.data.where(c.pre):c.pre(c.data,d)),void c.aggregate(c,d)):void console.error("Must specify aggregate function, chartType, and container before drawing chart",c)},a.Chart=b,a.BarChart=c,a.LineChart=d,a.MultiBarChart=f,a.PieChart=e,a.LinePlusBarChart=g,a.Table=h}(window.ADL=window.ADL||{}); \ No newline at end of file diff --git a/examples/childcharts.html b/examples/childcharts.html index 3af9bd2..4e4d36c 100644 --- a/examples/childcharts.html +++ b/examples/childcharts.html @@ -75,6 +75,18 @@

var saveTest = '', scoreArr, totalStudents = 30; dash.addStatements(window.statements); + + var minMaxAverage = dash.createMultiBarChart({ + pre: function(data){ + return data.where("result.score.raw != null").orderBy("object.definition.name"); + }, + aggregate: ADL.multiAggregate("result.score.raw", ADL.min, ADL.average, ADL.max), + groupBy: 'object.definition.name', + customize: function(nvd3Chart){ + nvd3Chart.forceY([0, 120]); + nvd3Chart.yAxis.axisLabel("Grade"); + } + }); var studentAnswersTable = dash.createTable({ container: '#table', @@ -184,80 +196,9 @@

child: studentsInRange }); - var minMaxAverage = dash.createMultiBarChart({ - pre: function(data){ - return data.where("result.score.raw != null").orderBy("object.definition.name"); - }, - aggregate: ADL.multiAggregate("result.score.raw", ADL.min, ADL.average, ADL.max), - groupBy: 'object.definition.name', - customize: function(nvd3Chart){ - nvd3Chart.forceY([0, 120]); - nvd3Chart.yAxis.axisLabel("Grade"); - }, - child: [incorrectChart, scoreRanges, scoreRangesPie] - }); - + minMaxAverage.addChild([incorrectChart, scoreRanges, scoreRangesPie]); minMaxAverage.draw(); - /*$('#scores h1').textContent = 'High Scorers'; - var data = test1Results.orderBy('result.score.raw','descending').selectFirst(10); - for(var i=0; i' - +e.point.sample.verb.id - +'

' - +y - +'

'; - }); - - // takes an array of color strings - chart.color(['#1f77b4']) - - // rotate the x-axis labels 45 degress, useful for long strings - chart.xAxis.rotateLabels(45); - - // apply some transformation to the x-axis labels - chart.xAxis.tickFormat(function(d){ return /[^\/]+$/.exec(d)[0]; }); - - chart.yAxis.tickFormat(d3.format(',d')); - - chart.discretebar.dispatch.on('elementClick', function(e){ - if(confirm('Go to '+e.point.result.sample.object.definition.moreInfo+'?')){ - window.open(e.point.result.sample.object.definition.moreInfo, '_blank'); - - chart.interpolate('monotone').showLegend(false); - - **************************************/ - /*if( window.statements ){ dash.addStatements(window.statements); window.statements = null; diff --git a/package.json b/package.json index 3b1c2ad..8202c5c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xAPI-Dashboard", - "version": "1.0.0", + "version": "1.0.1", "devDependencies": { "grunt": "~0.4.2", "grunt-contrib-jshint": "~0.6.3", diff --git a/src/chart.js b/src/chart.js index 4b5ffa3..1717687 100644 --- a/src/chart.js +++ b/src/chart.js @@ -93,8 +93,10 @@ myNode.removeChild(myNode.firstChild); } } - - next.event = e; + + if(next != self.parent) + next.event = e; + next.draw(); } });