Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
40 KiB

(function(T){function hd(){function p(d,e){d.attr("transform",function(d){return"translate("+(e(d)+da)+", 0)"})}function t(d,e){d.attr("transform",function(d){return"translate(0,"+e(d)+")"})}function T(d){var e=d[0];d=d[d.length-1];return e<d?[e,d]:[d,e]}function Da(d){for(var e=[],p=Math.ceil(d[0]);p<d[1];p++)e.push(p);0<e.length&&0<e[0]&&e.unshift(e[0]-(e[1]-e[0]));return e}function Ea(d){d=d<U.length?U[d]:d;return V?V(d):d}function l(l){l.each(function(){var l=d.select(this),ma=Da(q.domain()),
L=l.selectAll(".tick.major").data(ma,String),G=L.enter().insert("g","path").attr("class","tick major").style("opacity",1E-6),H=d.transition(L.exit()).style("opacity",1E-6).remove(),W=d.transition(L).style("opacity",1),P,Q=q.rangeExtent?q.rangeExtent():T(q.range()),l=l.selectAll(".domain").data([0]);l.enter().append("path").attr("class","domain");var l=d.transition(l),M=q.copy(),V=this.__chart__||M;this.__chart__=M;G.append("line");G.append("text");var U=G.select("line"),Fa=W.select("line"),va=L.select("text"),
$a=G.select("text"),Ga=W.select("text");da=(M(1)-M(0))/2;L=wa?0:da;switch(ea){case "bottom":P=p;U.attr("y2",I);$a.attr("y",Math.max(I,0)+e);Fa.attr("x1",L).attr("x2",L).attr("y2",I);Ga.attr("x",0).attr("y",Math.max(I,0)+e);va.attr("dy",".71em").style("text-anchor","middle");va.text(function(d){return ma.length<X||0===d%Math.ceil(ma.length/X)?Ea(d):""});l.attr("d","M"+Q[0]+","+C+"V0H"+Q[1]+"V"+C);break;case "left":P=t,U.attr("x2",-I),$a.attr("x",-(Math.max(I,0)+e)),Fa.attr("x2",-I).attr("y2",0),Ga.attr("x",
-(Math.max(I,0)+e)).attr("y",da),va.attr("dy",".32em").style("text-anchor","end"),va.text(function(d){return ma.length<X||0===d%Math.ceil(ma.length/X)?Ea(d):""}),l.attr("d","M"+-C+","+Q[0]+"H0V"+Q[1]+"H"+-C)}if(q.ticks)G.call(P,V),W.call(P,M),H.call(P,M);else{var Ha=M.rangeBand()/2,H=function(d){return M(d)+Ha};G.call(P,H);W.call(P,H)}})}var q=d.scale.linear(),ea="bottom",I=6,C=6,e=3,wa=!1,X=10,da=0,V=null,U=[];l.scale=function(d){if(!arguments.length)return q;q=d;return l};l.orient=function(d){if(!arguments.length)return ea;
ea=d in{top:1,right:1,bottom:1,left:1}?d+"":"bottom";return l};l.categories=function(d){if(!arguments.length)return U;U=d;return l};l.tickCentered=function(d){if(!arguments.length)return wa;wa=d;return l};l.tickTextNum=function(d){if(!arguments.length)return X;X=d;return l};l.tickFormat=function(d){if(!arguments.length)return V;V=d;return l};l.tickOffset=function(){return da};l.ticks=function(){};return l}function t(d){return"undefined"===typeof d}function p(d){return"undefined"!==typeof d}var tb=
T.c3={},d=T.d3;tb.generate=function(ca){var Yb,Zb,Da,Ea,l,q,ea,I,C;function e(a,b){for(var c=ca,h=0;h<a.length;h++){if(!(a[h]in c))return b;c=c[a[h]]}return c}function wa(){ub=null===ab?da():ab;xa=X();$b=20+ac+na;bc=cc?cc:dc?vb||g?1:40:20;bb=ec?ec:wb?1:40;fc=xa-ac-na;gc=20+na;hc=xa-na;q=0;ea=bc;I=$b;C=bb;Da=fc;Ea=gc;l=bb;Yb=hc;Zb=bb;n=ub-C-ea;r=xa-q-I;oa=xa-Da-Ea;xb=r/2;cb=0.95*xb}function X(){var a=null===ic?+d.select(ya).style("height").replace("px",""):ic;return 0<a?a:320}function da(){return+d.select(ya).style("width").replace("px",
"")}function V(){return n+2+C+ea}function U(){return 40}function ma(){return C+20}function tb(){return r-q+42}function Xb(){jc=g?10:0;kc=g?r:n;yb=g?0:r;zb=g?n:1;m=L(jc,kc,p(m)?m.domain():void 0,function(){return D.tickOffset()});x=G(yb,zb,p(x)?x.domain():void 0);Y=G(yb,zb,p(Y)?Y.domain():void 0);fa=L(0,n,p(Z)?Z:void 0,function(a){return 0===a%1?Ia.tickOffset():0});db=G(oa,10);eb=G(oa,10);D=P(m,kd);pa=d.svg.axis().scale(x).orient(ld);fb=d.svg.axis().scale(Y).orient(md);Ia=P(fa,nd);gb=id();lc=Fa();
mc=Fa(0.98)}function L(a,b,c,h){var s=(z?d.time.scale():d.scale.linear()).range([a,b]);s.orgDomain=function(){return s.domain()};p(c)&&s.domain(c);t(h)&&(h=function(){return 0});if($){var J=s,e,s=function(a){return J(a)+h(a)};for(e in J)s[e]=J[e];s.orgDomain=function(){return J.domain()};s.domain=function(a){if(!arguments.length)return a=J.domain(),[a[0],a[1]+1];J.domain(a);return s}}return s}function G(a,b){return d.scale.linear().range([a,b])}function H(a){return"y2"===Q(a)?Y:x}function W(a){return"y2"===
Q(a)?eb:db}function P(a,b){var c=($?hd():d.svg.axis()).scale(a).orient(b);c.tickFormat(M());$?c.categories(Ja).tickCentered(od):c.tickOffset=function(){return 0};return c}function Q(a){return a in nc?nc[a]:"y"}function M(){var a=z?pd:$?qd:function(a){return a};hb&&(a="function"===typeof hb?hb:z?function(a){return d.time.format(hb)(a)}:a);return a}function Za(a){var b=!1;Ab(f.data.targets).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)});return b?a:null}function id(){var a=d.svg.arc().outerRadius(cb).innerRadius(0),
b=function(b,h){var s;return h?a(b):(s=Za(b))?a(s):"M 0 0"};b.centroid=a.centroid;return b}function Fa(a){var b=d.svg.arc().outerRadius(xb*(a?a:1)).innerRadius(0);return function(a){return(a=Za(a))?b(a):"M 0 0"}}function va(a){a=Za(a);var b,c;b="";a&&(b=gb.centroid(a),a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b="translate("+0.8*(a/c)*cb+","+0.8*(b/c)*cb+")");return b}function $a(a){return(100*(a.endAngle-a.startAngle)/(2*Math.PI)).toFixed(1)+"%"}function Ga(a,b){var c=d.selectAll(".chart-arc.target"+(a?
"-"+a:"")),h=d.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",lc).transition().duration(100).attr("d",mc);b||h.style("opacity",0.3)}function Ha(a){d.selectAll(".chart-arc.target"+(a?"-"+a:"")).selectAll("path").transition().duration(50).attr("d",gb);d.selectAll(".-arc").style("opacity",1)}function jd(a){return d.min(a,function(a){return d.min(a.values,function(a){return a.value})})}function rd(a){var b={},c,h;a.forEach(function(a){b[a.id]=
[];a.values.forEach(function(c){b[a.id].push(c.value)})});for(c=0;c<u.length;c++)for(h=1;h<u[c].length;h++)Ka(u[c][h])&&(t(b[u[c][h]])||b[u[c][h]].forEach(function(a,d){Q(u[c][h])===Q(u[c][0])&&(b[u[c][0]][d]+=1*a)}));return d.max(Object.keys(b).map(function(a){return d.max(b[a])}))}function ib(a){var b=jb(function(b){return Q(b.id)===a}),c="y2"===a?sd:td,h="y2"===a?ud:vd,c=null!==c?c:jd(b),h=null!==h?h:rd(b),s=0.1*Math.abs(h-c),d=s,e=s,g="y2"===a?wd:xd;null!==g&&(c=Math.max(Math.abs(c),Math.abs(h)),
h=c-g,c=g-c);"y"===a&&null!==La&&(d=p(La.top)?La.top:s,e=p(La.bottom)?La.bottom:s);"y2"===a&&null!==Ma&&(d=p(Ma.top)?Ma.top:s,e=p(Ma.bottom)?Ma.bottom:s);return[Bb(b,"bar")?0:c-e,h+d]}function Cb(a){var b;a?(a=m.domain(),b=K.extent()):(a=Z,b=m.domain());return(a[1]-a[0])/(b[1]-b[0])}function yd(){var a=$?0:0.01*Math.abs(ga-qa),b=z?new Date(ga.getTime()-a):ga-a,a=z?new Date(qa.getTime()+a):qa+a;return[b,a]}function zd(a){for(var b=0;b<a.length;b++)if(!(a[b]in kb))return!1;return!0}function Ad(a){for(var b=
[],c=0;c<a.length;c++)a[c]in kb&&b.push(oc(kb[a[c]]));return b}function Db(a){return"start"in a?m(z?ra(a.start):a.start):0}function pc(a){var b=Db(a);a=("end"in a?m(z?ra(a.end):a.end):n)-b;return 0>a?0:a}function qc(a){return sa&&a===sa||aa&&Bd(aa,a)}function Cd(a){return!qc(a)}function lb(a){var b=Na[a.id];a.name=p(b)?b:a.id;return a}function rc(a){var b=a[0],c={},h=[],d,J;for(d=1;d<a.length;d++){c={};for(J=0;J<a[d].length;J++)c[b[J]]=a[d][J];h.push(c)}return h}function sc(a){var b=[],c,h,d;for(c=
0;c<a.length;c++)for(d=a[c][0],h=1;h<a[c].length;h++)t(b[h-1])&&(b[h-1]={}),b[h-1][d]=a[c][h];return b}function Oa(a){var b=d.keys(a[0]).filter(Cd),c=d.keys(a[0]).filter(qc);if(z&&0===c.length)return T.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Eb&&b.forEach(function(b){var d=sa?sa:aa?aa[b]:null;0<=c.indexOf(d)&&(f.data.x[b]=a.map(function(a){return a[d]}))});b=b.map(function(b){var c=Dd(b);return{id:c,id_org:b,values:a.map(function(a,d){var e;e=sa?sa:aa?aa[b]:
null;e=z?ra(a[e]):Eb?a[e]?a[e]:b in f.data.x&&f.data.x[d]?f.data.x[d]:d:d;if(e<ga||null===ga)ga=e;qa<e&&(qa=e);a.x=e;return{x:e,value:null===a[b]||isNaN(a[b])?null:+a[b],id:c}})}});b.forEach(function(a){var b;a.values=a.values.sort(function(a,b){return(a.x||0===a.x?a.x:Infinity)-(b.x||0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});b.forEach(function(a){kb[a.id_org]=oc(a)});return b}function oc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,
value:a.value,id:a.id}})}}function Pa(){return d.max(f.data.targets,function(a){return a.values.length})}function mb(a){a=t(a)?f.data.targets:a;return a.map(function(a){return a.id})}function tc(a){var b=mb(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function jb(a){return p(a)?f.data.targets.filter(a):f.data.targets}function qd(a){return a<Ja.length?Ja[a]:a}function nb(a){return"-shapes -shapes-"+a.id}function uc(a){return nb(a)+" -line -line-"+a.id}function Ed(a){return nb(a)+" -circles -circles-"+
a.id}function vc(a){return nb(a)+" -bars -bars-"+a.id}function Fd(a){return nb(a.data)+" -arc -arc-"+a.data.id}function Gd(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function wc(a,b){return"-shape -shape-"+b+" -bar -bar-"+b}function Hd(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function ob(a){return m(a.x)}function Qa(a){return m(z?ra(a.value):a.value)}function xc(a){return x(a.value)}function yc(a,b){var c,h=a[b].x,d=[];for(c=b-1;0<=c&&h===a[c].x;c--)d.push(a[c]);
for(c=b;c<a.length&&h===a[c].x;c++)d.push(a[c]);return d}function zc(a,b,c,h){c=c?c:0;h=h?h:a.length-1;var d=Math.floor((h-c)/2)+c;0<m(a[d].x)-b[0]?h=d:c=d;return 1===h-c?(d=[],a[c].x&&(d=d.concat(yc(a,c))),a[h].x&&(d=d.concat(yc(a,h))),Ac(d,b)):zc(a,b,c,h)}function Bc(a,b){var c;c=a.map(function(a){return zc(a.values,b)});return Ac(c,b)}function Ac(a,b){var c,h;a.forEach(function(a){var d=Fb(a,b);if(d<c||!c)c=d,h=a});return h}function Cc(a,b){R.html(Dc(a)).style("visibility","hidden").style("display",
"block");var c=R.property("offsetWidth"),h=R.property("offsetHeight");R.style("top",(b[1]+15+h<X()?b[1]+15:b[1]-h)+"px").style("left",g?b[0]:m(a[0].x)+60+c<(null===ab?da():ab)?m(a[0].x)+60+"px":m(a[0].x)-c+30+"px").style("visibility","visible")}function Ec(a){Bb(f.data.targets,"scatter")||A(f.data.targets)||k.selectAll("line.xgrid-focus").style("visibility","visible").data([a]).attr(g?"y1":"x1",ob).attr(g?"y2":"x2",ob)}function Fc(){k.select("line.xgrid-focus").style("visibility","hidden")}function ha(a){return a.x||
0===a.x?m(a.x):null}function ia(a){return H(a.id)(a.value)}function Id(){var a={},b=0,c,h;jb(Ka).forEach(function(d){for(c=0;c<u.length;c++)if(!(0>u[c].indexOf(d.id)))for(h=0;h<u[c].length;h++)if(u[c][h]in a){a[d.id]=a[u[c][h]];break}t(a[d.id])&&(a[d.id]=b++)});a.__max__=b-1;return a}function Gc(a,b,c,h){var d=h?fa:m;return b?function(h){var e=h.id in c?c[h.id]:0;return h.x||0===h.x?d(h.x)-a*(b/2-e):0}:function(){return 0}}function Hc(a,b,c,h){var d=Object.keys(b);return function(e,g){var f=0,k=h?
W(e.id):H(e.id);jb(Ka).forEach(function(c){c.id!==e.id&&b[c.id]===b[e.id]&&d.indexOf(c.id)<d.indexOf(e.id)&&(f+=a(c.values[g]))});return c?f:k(e.value)-f}}function Ic(a,b){var c=null===a?function(a){return a}:function(b){return a>b?a-b:0};return function(a){var d=b?W(a.id):H(a.id);return c(d(a.value))}}function Ra(a,b){var c=t(a)?mb():a;"string"===typeof c&&(c=[c]);for(var h=0;h<c.length;h++)N[c[h]]=b}function Bb(a,b){var c=!1;a.forEach(function(a){N[a.id]===b&&(c=!0);a.id in N||"line"!==b||(c=!0)});
return c}function A(a){return Bb(a,"pie")}function Gb(a){a="string"===typeof a?a:a.id;return!(a in N)||"line"===N[a]||"spline"===N[a]}function Ka(a){return"bar"===N["string"===typeof a?a:a.id]}function Jc(a){return"pie"===N["string"===typeof a?a:a.id]}function Kc(a){return Ka(a)?a.values:[]}function Jd(a){var b;(b=Gb(a))||(b="scatter"===N["string"===typeof a?a:a.id]);return b?a.values:[]}function ra(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Hb+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");
b=d.time.format(Hb).parse(a);if(!b)throw Error("Failed to parse '"+a+"' with format "+Hb);return b}function Lc(a,b){var c=d.mouse(a),h=d.select(a),e=1*h.attr("cx"),h=1*h.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(h-c[1],2))<b}function Mc(a){var b=d.mouse(a),c=d.select(a);a=1*c.attr("x");var h=1*c.attr("y"),c=1*c.attr("width");return a-10<b[0]&&b[0]<a+c+10&&h-10<b[1]}function Kd(a,b){var c;for(c=0;c<b.length;c++)if(b[c].start<a&&a<=b[c].end)return!0;return!1}function Bd(a,b){var c=!1;
Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)});return c}function Fb(a,b){return Math.pow(m(a.x)-b[0],2)+Math.pow(x(a.value)-b[1],2)}function Nc(a,b,c){Ld(a,b);k.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).data([b]).enter().append("circle").attr("class",function(){return"selected-circle selected-circle-"+c}).attr("cx",g?ia:ha).attr("cy",g?ha:ia).attr("stroke",function(){return S(b.id)}).attr("r",1.4*Sa).transition().duration(100).attr("r",Sa)}function Ib(a,b,c){Md(a,b);
k.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).transition().duration(100).attr("r",0).remove()}function Oc(a,b,c,d){a?Nc(b,c,d):Ib(b,c,d)}function Nd(){}function Pc(){}function Qc(a,b,c,d){}function Rc(a){return a.filter(function(a){return null!==a.value})}function Jb(a,b){return(b?k.selectAll(".-circles-"+b):k).selectAll(".-circle"+(a||0===a?"-"+a:""))}function Kb(a){Jb(a).filter(function(){return d.select(this).classed(ba)}).classed(ba,!1).attr("r",Lb)}function Sc(a){return k.selectAll(".-bar"+
(a||0===a?"-"+a:""))}function Od(a,b,c,d){var e,f,k="M",m,l,n,Tc,r,q=[];if(p(d))for(e=0;e<d.length;e++)q[e]={},t(d[e].start)?q[e].start=a[0].x:q[e].start=z?ra(d[e].start):d[e].start,t(d[e].end)?q[e].end=a[a.length-1].x:q[e].end=z?ra(d[e].end):d[e].end;Tc=g?function(a){return c(a.value)}:function(a){return b(a.x)};r=g?function(a){return b(a.x)}:function(a){return c(a.value)};d=z?function(a,d,h,e){var f=a.x.getTime();a=d.x-a.x;d=new Date(f+a*(h+e));return"M"+b(new Date(f+a*h))+" "+c(l(h))+" "+b(d)+
" "+c(l(h+e))}:function(a,d,h,e){return"M"+b(m(h))+" "+c(l(h))+" "+b(m(h+e))+" "+c(l(h+e))};for(e=0;e<a.length;e++)if(t(q)||!Kd(a[e].x,q))k+=" "+Tc(a[e])+" "+r(a[e]);else{m=L(a[e-1].x,a[e].x);l=G(a[e-1].value,a[e].value);f=b(a[e].x)-b(a[e-1].x);n=c(a[e].value)-c(a[e-1].value);f=Math.sqrt(Math.pow(f,2)+Math.pow(n,2));n=2/f;var u=2*n;for(f=n;1>=f;f+=u)k+=d(a[e-1],a[e],f,n)}return k}function Mb(a){var b,c;pb=d.select(ya);if(pb.empty())T.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');
else{pb.html("");f.data.x={};f.data.targets=Oa(a);wa();Xb();m.domain(d.extent(yd()));x.domain(ib("y"));Y.domain(ib("y2"));fa.domain(m.domain());db.domain(x.domain());eb.domain(Y.domain());D.ticks(10>a.length?a.length:10);pa.ticks(Pd).outerTickSize(0).tickFormat(Qd);fb.ticks(Rd).outerTickSize(0).tickFormat(Sd);Z=m.domain();K.x(fa);ta&&E.x(m);Ta=d.select(ya).append("svg").attr("width",n+C+ea).attr("height",r+q+I).on("mouseenter",Td).on("mouseleave",Ud);qb=Ta.append("defs");qb.append("clipPath").attr("id",
Nb).append("rect").attr("y",q).attr("width",n).attr("height",r-q);qb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1-C).attr("y",-20).attr("width",V).attr("height",U);qb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-C+1).attr("y",q-1).attr("width",ma).attr("height",tb);k=Ta.append("g").attr("transform",F.main);y=za?Ta.append("g").attr("transform",F.context):null;Aa=Ba?Ta.append("g").attr("transform",F.legend):null;R=d.select(ya).style("position","relative").append("div").style("position",
"absolute").style("z-index","10").style("display","none");k.append("g").attr("class","x axis").attr("clip-path",g?"":"url(#xaxis-clip)").attr("transform",F.x).call(g?pa:D).append("text").attr("class","-axis-x-label").attr("x",n).attr("dy","-.5em").style("text-anchor","end").text(Vd);k.append("g").attr("class","y axis").attr("clip-path",g?"url(#yaxis-clip)":"").call(g?D:pa).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(Wd);dc&&
k.append("g").attr("class","y2 axis").attr("transform",F.y2).call(fb);b=k.append("g").attr("clip-path",Ua).attr("class","grid");Uc&&b.append("g").attr("class","xgrids");Ob&&(c=b.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(Ob).enter().append("g").attr("class","xgrid-line"),c.append("line").attr("class",function(a){return""+a["class"]}),c.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",g?"":"rotate(-90)").attr("dx",g?
0:-q).attr("dy",-6).text(function(a){return a.text}));Xd&&b.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",g?0:-10).attr("x2",g?n:-10).attr("y1",g?-10:q).attr("y2",g?-10:r);Vc&&b.append("g").attr("class","ygrids");Pb&&b.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(Pb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});k.append("g").attr("clip-path",Ua).attr("class","regions");k.append("g").attr("clip-path",
Ua).attr("class","chart");b=k.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",ta?"ew-resize":null);aa?Yd(b):Zd(b,a);k.select(".chart").append("g").attr("class","chart-bars");k.select(".chart").append("g").attr("class","chart-lines");k.select(".chart").append("g").attr("class","chart-arcs").attr("transform",F.arc);if(ta)k.insert("rect",$d?null:"g.grid").attr("class","zoom-rect").attr("width",n).attr("height",r).style("opacity",0).style("cursor","ew-resize").call(E).on("dblclick.zoom",
null);null!==rb&&K.extent("function"!==typeof rb?rb:rb(ga,qa));za&&(y.append("g").attr("clip-path",Ua).attr("class","chart"),y.select(".chart").append("g").attr("class","chart-bars"),y.select(".chart").append("g").attr("class","chart-lines"),y.append("g").attr("clip-path",Ua).attr("class","x brush").call(K).selectAll("rect").attr("height",oa),y.append("g").attr("class","x axis").attr("transform",F.subx).call(Ia));Ba&&sb(f.data.targets);Wc(f.data.targets);B({withTransition:!1,withUpdateXDomain:!0});
if(ae){if(z&&"string"===typeof Ca){Ca=ra(Ca);for(a=0;a<f.data.targets[0].values.length&&0!==f.data.targets[0].values[a].x-Ca;a++);Ca=a}R.html(Dc(f.data.targets.map(function(a){return lb(a.values[Ca])})));R.style("top",Xc.top).style("left",Xc.left).style("display","block")}null==T.onresize&&(T.onresize=be)}}function Zd(a,b){a.selectAll(".event-rects").data(b).enter().append("rect").attr("class",function(a,b){return"event-rect event-rect-"+b}).style("cursor",ja&&ua?"pointer":null).on("mouseover",function(a,
b){if(!Va&&!A(f.data.targets)){var d=f.data.targets.map(function(a){return lb(a.values[b])}),e,g;if(0<Object.keys(Na).length){g=[];for(var k in Na)for(e=0;e<d.length;e++)if(d[e].id===k){g.push(d[e]);d.shift(e);break}d=g.concat(d)}Qb&&Jb(b,void 0).classed(ba,!0).attr("r",Rb);Sc(b).classed(ba,!1);Ec(d[0])}}).on("mouseout",function(a,b){A(f.data.targets)||(Fc(),R.style("display","none"),Kb(b),Sc(void 0).classed(ba,!1))}).on("mousemove",function(a,b){var e;Va||A(f.data.targets)||(e=f.data.targets.map(function(a){return lb(a.values[b])}),
Cc(e,d.mouse(this)),ja&&(ua||k.selectAll(".-shape-"+b).filter(function(a){return ka(a)}).each(function(){var a=d.select(this).classed(ba,!0);"circle"===this.nodeName&&a.attr("r",Rb);d.select(".event-rect-"+b).style("cursor",null)}).filter(function(){var a=d.select(this);if("circle"===this.nodeName)return Lc(this,Sa);if("rect"===this.nodeName)return Mc(this,a.attr("x"),a.attr("y"))}).each(function(){var a=d.select(this);a.classed(ba)||(a.classed(ba,!0),"circle"===this.nodeName&&a.attr("r",Sa));d.select(".event-rect-"+
b).style("cursor","pointer")})))}).on("click",function(a,b){A(f.data.targets)||(Sb?Sb=!1:k.selectAll(".-shape-"+b).each(function(a){Yc(this,a,b)}))}).call(d.behavior.drag().origin(Object).on("drag",function(){Zc(d.mouse(this))}).on("dragstart",function(){$c(d.mouse(this))}).on("dragend",function(){ad()})).call(E).on("dblclick.zoom",null)}function Yd(a){a.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",r).attr("class","event-rect").on("mouseout",function(){A(f.data.targets)||(Fc(),
R.style("display","none"),Kb())}).on("mousemove",function(){var a,c,e;Va||A(f.data.targets)||(a=d.mouse(this),c=Bc(f.data.targets,a),e=[lb(c)],Cc(e,a),Qb&&(Kb(),Jb(c.index,c.id).classed(ba,!0).attr("r",Rb)),Ec(e[0]),100>Fb(c,a)?d.select(".event-rect").style("cursor","pointer"):d.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;A(f.data.targets)||(a=d.mouse(this),c=Bc(f.data.targets,a),100>Fb(c,a)&&k.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){Yc(this,
c,c.index)}))}).call(d.behavior.drag().origin(Object).on("drag",function(){Zc(d.mouse(this))}).on("dragstart",function(){$c(d.mouse(this))}).on("dragend",function(){ad()})).call(E).on("dblclick.zoom",null)}function Yc(a,b,c){var e=d.select(a),f=e.classed(la),g=!1,k;"circle"===a.nodeName?(g=Lc(a,1.5*Sa),k=Oc):"rect"===a.nodeName&&(g=Mc(a),k=Qc);if(ua||g)ja&&ka(b)&&(e.classed(la,!f),k(!f,e,b,c)),ce(b,e)}function Zc(a){var b,c,e,g,m,v,l;A(f.data.targets)||!ja||ta&&!E.altDomain||(b=Tb[0],c=Tb[1],e=a[0],
a=a[1],g=Math.min(b,e),m=Math.max(b,e),v=ua?q:Math.min(c,a),l=ua?r:Math.max(c,a),k.select(".dragarea").attr("x",g).attr("y",v).attr("width",m-g).attr("height",l-v),k.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return ka(a)}).each(function(a,b){var c=d.select(this),e=c.classed(la),h=c.classed(Ub),f,k,p,n;f=!1;"circle"===this.nodeName?(f=1*c.attr("cx"),k=1*c.attr("cy"),n=Oc,f=g<f&&f<m&&v<k&&k<l):"rect"===this.nodeName&&(f=1*c.attr("x"),k=1*c.attr("y"),p=1*c.attr("width"),n=Qc,f=g<
f+p&&f<m&&k<l);f^h&&(c.classed(Ub,!h),c.classed(la,!e),n(!e,c,a,b))}))}function $c(a){!A(f.data.targets)&&ja&&(Tb=a,k.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Va=!0)}function ad(){!A(f.data.targets)&&ja&&(k.select(".dragarea").transition().duration(100).style("opacity",0).remove(),k.selectAll(".-shape").classed(Ub,!1),Va=!1)}function B(a){var b,c,e=Id(),s=e.__max__+1,l,v,t,u,w;a=p(a)?a:{};b=p(a.withY)?a.withY:!0;u=p(a.withSubchart)?a.withSubchart:!0;w=p(a.withTransition)?
a.withTransition:!0;a=p(a.withUpdateXDomain)?a.withUpdateXDomain:!1;l=A(f.data.targets);w=w?250:0;a&&(m.domain(K.empty()?Z:K.extent()),ta&&E.x(m).updateScaleExtent());x.domain(ib("y"));Y.domain(ib("y2"));k.select(".x.axis").transition().duration(g?w:0).call(g?pa:D).style("opacity",l?0:1);k.select(".y.axis").transition().duration(g?0:w).call(g?D:pa).style("opacity",l?0:1);k.select(".y2.axis").transition().call(fb).style("opacity",l?0:1);k.select(".x.axis .-axis-x-label").attr("x",n);db.domain(x.domain());
eb.domain(Y.domain());R.style("display","none");k.select("line.xgrid-focus").style("visibility","hidden").attr("y2",r);if(Uc){if("year"===de)for(a=[],v=ga.getFullYear(),l=qa.getFullYear();v<=l;v++)a.push(new Date(v+"-01-01 00:00:00"));else a=m.ticks(10);a=k.select(".xgrids").selectAll(".xgrid").data(a);a.enter().append("line").attr("class","xgrid");a.attr("x1",g?0:function(a){return m(a)-D.tickOffset()}).attr("x2",g?n:function(a){return m(a)-D.tickOffset()}).attr("y1",g?function(a){return m(a)-D.tickOffset()}:
q).attr("y2",g?function(a){return m(a)-D.tickOffset()}:r).style("opacity",function(){return+d.select(this).attr(g?"y1":"x1")===(g?r:0)?0:1});a.exit().remove()}Ob&&(a=k.selectAll(".xgrid-lines"),a.selectAll("line").attr("x1",g?0:Qa).attr("x2",g?n:Qa).attr("y1",g?Qa:q).attr("y2",g?Qa:r),a.selectAll("text").attr("x",g?n:0).attr("y",Qa));b&&Vc&&(a=k.select(".ygrids").selectAll(".ygrid").data(x.ticks(10)),a.enter().append("line").attr("class","ygrid"),a.attr("x1",g?x:0).attr("x2",g?x:n).attr("y1",g?0:
x).attr("y2",g?r:x),a.exit().remove());b&&Pb&&k.select(".ygrid-lines").selectAll(".ygrid-line").attr("y1",xc).attr("y2",xc);l=$?s?1.2*D.tickOffset()/s:0:0.6*((g?r:n)*Cb(!1)/(Pa()-1));v=Ic(g?null:r);b=Gc(l,s,e);a=Hc(v,e,g);c=k.selectAll(".-bars").selectAll(".-bar").data(Kc);c.transition().duration(w).attr("x",g?a:b).attr("y",g?b:a).attr("width",g?v:l).attr("height",g?l:v);c.enter().append("rect").attr("class",wc).attr("x",g?a:b).attr("y",g?b:a).attr("width",g?v:l).attr("height",g?l:v).style("opacity",
0).transition().duration(w).style("opacity",1);c.exit().transition().duration(w).style("opacity",0).remove();k.selectAll(".chart-line").select(".-line").transition().duration(w).attr("d",ee);b=k.selectAll(".-circles").selectAll(".-circle").data(Jd);b.transition().duration(w).style("opacity",function(a){return null===a.value?0:1}).attr("cx",g?ia:ha).attr("cy",g?ha:ia);b.enter().append("circle").style("opacity",function(a){return null===a.value?0:1}).attr("class",Gd).attr("cx",g?ia:ha).attr("cy",g?
ha:ia).attr("r",Lb);b.exit().remove();k.selectAll(".chart-arc").select(".-arc").style("opacity",function(a){return a===this._current?0:1}).transition().duration(w).attrTween("d",function(a){a=Za(a);if(!a)return function(){return"M 0 0"};var b=d.interpolate(this._current,a);this._current=b(0);return function(a){a=b(a);return Jc(a.data)?gb(a,!0):"M 0 0"}}).style("opacity",1);k.selectAll(".chart-arc").select("text").attr("transform",va).attr("opacity",0).transition().duration(w).text($a).attr("opacity",
function(a){return Jc(a.data)?1:0});za&&(null!==d.event&&"zoom"===d.event.type&&K.extent(m.orgDomain()).update(),u&&(y.select(".x.axis").transition().duration(g?w:0).call(g?pa:Ia),K.empty()||K.extent(m.orgDomain()).update(),l=$?s?1.2*Ia.tickOffset()/s:0:0.6*((g?r:n)*Cb(!0)/(Pa()-1)),v=Ic(oa,!0),b=Gc(l,s,e,!0),a=Hc(v,e,!1,!0),e=y.selectAll(".-bars").selectAll(".-bar").data(Kc),e.transition().duration(w).attr("x",b).attr("y",a).attr("width",l).attr("height",v),e.enter().append("rect").attr("class",
wc).attr("x",b).attr("y",a).attr("width",l).attr("height",v).style("opacity",0).transition().style("opacity",1),e.exit().transition().style("opacity",0).remove(),y.selectAll(".-line").transition().duration(w).attr("d",fe)));k.selectAll(".selected-circles").filter(function(a){return Ka(a)}).selectAll("circle").remove();k.selectAll(".selected-circle").transition().duration(w).attr("cx",g?ia:ha).attr("cy",g?ha:ia);aa||(Eb?(t=function(a,b){var c=0<b?f.data.targets[0].values[b-1].x:void 0,d=b<Pa()-1?f.data.targets[0].values[b+
1].x:void 0;return(m(d?d:a.x+50)-m(c?c:a.x-50))/2},e=function(a,b){var c=0<b?f.data.targets[0].values[b-1].x:void 0;return(m(a.x)+m(c?c:a.x-50))/2}):(t=(g?r:n)*Cb()/(Pa()-1),e=function(a){return m(a.x)-t/2}),k.selectAll(".event-rect").attr("x",g?0:e).attr("y",g?e:0).attr("width",g?n:t).attr("height",g?t:r));e=k.select(".regions").selectAll("rect.region").data(O);e.enter().append("rect");e.attr("class",Hd).attr("x",g?0:Db).attr("y",g?Db:q).attr("width",g?n:pc).attr("height",g?pc:r).style("fill-opacity",
function(a){return p(a.opacity)?a.opacity:0.1});e.exit().transition().duration(w).style("fill-opacity",0).remove()}function ge(){"mousemove"===d.event.sourceEvent.type&&E.altDomain?(m.domain(E.altDomain),E.x(m).updateScaleExtent()):($&&m.orgDomain()[0]===Z[0]&&m.domain([Z[0]-1E-10,m.orgDomain()[1]]),B({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===d.event.sourceEvent.type&&(Sb=!0))}function be(){wa();Xb();K.x(fa);ta&&E.x(m);d.select("svg").attr("width",ub).attr("height",xa);d.select("#"+
Nb).select("rect").attr("width",n).attr("height",r);d.select("#xaxis-clip").select("rect").attr("width",V);d.select(".zoom-rect").attr("width",n).attr("height",r);k.select(".x.axis").attr("transform",F.x);k.select(".y2.axis").attr("transform",F.y2);k.select(".chart-arcs").attr("transform",F.arc);za&&(y.select(".x.brush").selectAll("rect").attr("height",oa),y.attr("transform",F.context),y.select(".x.axis").attr("transform",F.subx));Ba&&(Aa.attr("transform",F.legend),sb(f.data.targets,{withTransition:!1}));
B({withTransition:!1,withUpdateXDomain:!0})}function Wc(a){var b;bd&&Ra(mb(a).filter(function(a){return!(a in N)}),bd);k.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").style("opacity",0).append("g").attr("class",vc).style("fill",function(a){return S(a.id)}).style("stroke",function(a){return S(a.id)}).style("stroke-width",0).style("cursor",function(a){return ka(a)?"pointer":null});
b=k.select(".chart-lines").selectAll(".chart-line").data(a).enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none").style("opacity",0);b.append("path").attr("class",uc).style("stroke",function(a){return S(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",Ed).style("fill",function(a){return S(a.id)}).style("cursor",function(a){return ka(a)?"pointer":null});a.forEach(function(a){k.selectAll(".selected-circles-"+
a.id).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=k.select(".chart-arcs").selectAll(".chart-arc").data(Ab(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}).style("opacity",0);b.append("path").attr("class",Fd).style("fill",function(a){return S(a.data.id)}).style("cursor",function(a){return ka(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){Ga(a.data.id);cd(a.data.id)}).on("mouseout",function(a){Ha(a.data.id);
dd()});b.append("text").attr("dy",".35em").style("text-anchor","middle").style("pointer-events","none");za&&(b=y.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("opacity",0),b.append("g").attr("class",vc).style("fill",function(a){return S(a.id)}),b=y.select(".chart-lines").selectAll(".chart-line").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("opacity",
0),b.append("path").attr("class",uc).style("stroke",function(a){return S(a.id)}));Ba&&sb(a);d.selectAll(".target").transition().style("opacity",1)}function Wa(a,b){f.data.targets.forEach(function(b){for(var d=0;d<a.length;d++)if(b.id===a[d].id){b.values=a[d].values;a.splice(d,1);break}});f.data.targets=f.data.targets.concat(a);Wc(f.data.targets);B();b()}function cd(a){d.selectAll(".legend-item").filter(function(b){return b!==a}).transition().duration(100).style("opacity",0.3)}function dd(){d.selectAll(".legend-item").transition().duration(100).style("opacity",
1)}function sb(a,b){var c=mb(a),d,e=n/2-Xa*Object.keys(a).length/2,g;b=t(b)?{}:b;g=p(b.withTransition)?b.withTransition:!0;d=Aa.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){he(a)}).on("mouseover",function(a){cd(a);f.focus(a)}).on("mouseout",function(){dd();f.revert()});d.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return na/
2-16}).attr("width",Xa).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return S(a)}).attr("x",-200).attr("y",function(){return na/2-9}).attr("width",10).attr("height",10);d.append("text").text(function(a){return p(Na[a])?Na[a]:a}).style("pointer-events","none").attr("x",-200).attr("y",function(){return na/2});Aa.selectAll("rect.legend-item-event").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+Xa*
b});Aa.selectAll("rect.legend-item-tile").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+Xa*b});Aa.selectAll("text").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+Xa*b+14})}function Ya(a){return p(a)?".target-"+a:".target"}function Vb(a){return tc(a.id)}function Wb(a){return"data"in a&&tc(a.data.id)}var f={data:{}},kb={},ba="_expanded_",la="_selected_",Ub="_included_",ya=e(["bindto"],"#chart"),ab=e(["size","width"],null),ic=e(["size","height"],null),
ec=e(["padding","left"],null),cc=e(["padding","right"],null),ta=e(["zoom","enabled"],!1),ed=e(["zoom","extent"],null),$d=e(["zoom","privileged"],!1),Td=e(["onenter"],function(){}),Ud=e(["onleave"],function(){});if(!("data"in ca))throw Error("data is required in config");var sa=e(["data","x"],null),aa=e(["data","xs"],null),Hb=e(["data","x_format"],"%Y-%m-%d"),Dd=e(["data","id_converter"],function(a){return a}),Na=e(["data","names"],{}),u=e(["data","groups"],[]),nc=e(["data","axes"],{}),bd=e(["data",
"type"],null),N=e(["data","types"],{}),fd=e(["data","regions"],{}),ie=e(["data","colors"],{}),ja=e(["data","selection","enabled"],!1),ua=e(["data","selection","grouped"],!1),ka=e(["data","selection","isselectable"],function(){return!0}),za=e(["subchart","show"],!1),ac=za?e(["subchart","size","height"],60):0,je=e(["color","pattern"],null),Ba=e(["legend","show"],!0),Xa=e(["legend","item","width"],80),he=e(["legend","item","onclick"],function(){}),gd=e(["axis","x","type"],"indexed"),Ja=e(["axis","x",
"categories"],[]),od=e(["axis","x","tick","centered"],!1),hb=e(["axis","x","tick","format"],null),rb=e(["axis","x","default"],null),Vd=e(["axis","x","label"],null),vd=e(["axis","y","max"],null),td=e(["axis","y","min"],null),xd=e(["axis","y","center"],null),Wd=e(["axis","y","label"],null),wb=e(["axis","y","inner"],!1),Qd=e(["axis","y","tick","format"],function(a){return a}),La=e(["axis","y","padding"],null),Pd=e(["axis","y","ticks"],10),dc=e(["axis","y2","show"],!1),ud=e(["axis","y2","max"],null),
sd=e(["axis","y2","min"],null),wd=e(["axis","y2","center"],null),vb=e(["axis","y2","inner"],!1),Sd=e(["axis","y2","tick","format"],function(a){return a}),Ma=e(["axis","y2","padding"],null),Rd=e(["axis","y2","ticks"],10),g=e(["axis","rotated"],!1),Uc=e(["grid","x","show"],!1),de=e(["grid","x","type"],"tick"),Ob=e(["grid","x","lines"],null),Vc=e(["grid","y","show"],!1),Pb=e(["grid","y","lines"],null),Lb=e(["point","show"],!0)?e(["point","r"],2.5):0,Xd=e(["point","focus","line","enabled"],!0),Qb=e(["point",
"focus","expand","enabled"],!0),Rb=e(["point","focus","expand","r"],Qb?4:Lb),Sa=e(["point","focus","select","r"],8),ce=e(["point","onclick"],function(){}),Ld=e(["point","onselected"],function(){}),Md=e(["point","onunselected"],function(){}),O=e(["regions"],[]),Dc=e(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+M()(a[0].x)+"</th></tr>",c,d,e;for(c=0;c<a.length;c++)p(a[c])?(d=p(a[c].value)?(Math.round(100*a[c].value)/100).toFixed(2):"-",e=a[c].name):e=d="-",
b+="<tr class='-tooltip-name-"+a[c].id+"'><td class='name'><span style='background-color:"+S(a[c].id)+"'></span>"+e+"</td><td class='value'>"+d+"</td></tr>";return b+"</table>"}),ae=e(["tooltip","init","show"],!1),Ca=e(["tooltip","init","x"],0),Xc=e(["tooltip","init","position"],{top:"0px",left:"50px"}),Nb=ya.replace("#","")+"-clip",Ua="url(#"+Nb+")",z="timeseries"===gd,$="categorized"===gd,Eb=!z&&(sa||aa),Tb=null,Va=!1,Sb=!1,na=Ba?40:0,S=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");
return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(ie,je),pd=function(){var a=[[d.time.format("%Y/%-m/%-d"),function(){return!0}],[d.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[d.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[d.time.format("%I %p"),function(a){return a.getHours()}],[d.time.format("%I:%M"),function(a){return a.getMinutes()}],[d.time.format(":%S"),
function(a){return a.getSeconds()}],[d.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),$b,gc,bc,bb,fc,hc,n,r,oa,ub,xa,cb,xb,gb,lc,mc,Ab,jc,kc,yb,zb,m,x,Y,fa,db,eb,D,pa,fb,Ia,kd=g?"left":"bottom",ld=g?wb?"top":"bottom":wb?"right":"left",md=g?vb?"bottom":"top":vb?"left":"right",nd="bottom",F={main:function(){return"translate("+C+","+q+")"},context:function(){return"translate("+l+","+Da+")"},legend:function(){return"translate("+
Zb+","+Yb+")"},y2:function(){return"translate("+(g?0:n)+","+(g?10:0)+")"},x:function(){return"translate(0,"+r+")"},subx:function(){return"translate(0,"+oa+")"},arc:function(){return"translate("+n/2+","+r/2+")"}};Ab=d.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var ee=function(){var a=d.svg.line().x(g?function(a){return H(a.id)(a.value)}:ob).y(g?ob:function(a){return H(a.id)(a.value)});return function(b){var c=Rc(b.values),d;if(Gb(b))return"spline"===
N["string"===typeof b?b:b.id]?a.interpolate("cardinal"):a.interpolate("linear"),fd[b.id]?Od(c,m,H(b.id),fd[b.id]):a(c);d=m(c[0].x);b=H(b.id)(c[0].value);return g?"M "+b+" "+d:"M "+d+" "+b}}(),fe=function(){var a=d.svg.line().x(function(a){return fa(a.x)}).y(function(a){return W(a.id)(a.value)});return function(b){var c=Rc(b.values);return Gb(b)?a(c):"M "+fa(c[0].x)+" "+W(b.id)(c[0].value)}}(),K=d.svg.brush().on("brush",function(){B({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),
E=d.behavior.zoom().on("zoomstart",function(){E.altDomain=d.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",ta?ge:null);K.update=function(){y&&y.select(".x.brush").call(this);return this};E.orgScaleExtent=function(){var a=ed?ed:[1,10];return[a[0],Math.max(Pa()/a[1],a[1])]};E.updateScaleExtent=function(){var a=m.orgDomain(),a=(a[1]-a[0])/(Z[1]-Z[0]),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var Ta,qb,k,y,Aa,R,pb,ga=null,qa=null,Z;f.focus=function(a){var b=d.selectAll(Ya(a)),
c=b.filter(Vb),b=b.filter(Wb);f.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);A(f.data.targets)&&Ga(a,!0)};f.defocus=function(a){var b=d.selectAll(Ya(a)),c=b.filter(Vb),b=b.filter(Wb);c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);A(f.data.targets)&&Ha(a)};f.revert=function(a){var b=d.selectAll(Ya(a)),c=b.filter(Vb),b=b.filter(Wb);c.classed("focused",
!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);A(f.data.targets)&&Ha(a)};f.show=function(a){d.selectAll(Ya(a)).transition().style("opacity",1)};f.hide=function(a){d.selectAll(Ya(a)).transition().style("opacity",0)};f.unzoom=function(){K.clear().update();B({withUpdateXDomain:!0})};f.load=function(a){t(a.done)&&(a.done=function(){});"categories"in a&&$&&(Ja=a.categories,D.categories(Ja));if("cacheIds"in a&&zd(a.cacheIds))Wa(Ad(a.cacheIds),a.done);else if("data"in
a)Wa(Oa(a.data),a.done);else if("url"in a)d.csv(a.url,function(b,c){Wa(Oa(c),a.done)});else if("rows"in a)Wa(Oa(rc(a.rows)),a.done);else if("columns"in a)Wa(Oa(sc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};f.unload=function(a){f.data.targets=f.data.targets.filter(function(b){return b.id!==a});d.selectAll(".target-"+a).transition().style("opacity",0).remove();Ba&&(d.selectAll(".legend-item-"+a).remove(),sb(f.data.targets));0<f.data.targets.length&&B()};f.selected=
function(a){a=p(a)?"-"+a:"";return d.merge(k.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return d.select(this).classed(la)}).map(function(a){return a.map(function(a){return a.__data__})}))};f.select=function(a,b,c){ja&&k.selectAll(".-shapes").selectAll(".-shape").each(function(e,f){var g="circle"===this.nodeName?Nc:Nd,k="circle"===this.nodeName?Ib:Pc;0<=b.indexOf(f)?ka(e)&&(ua||t(a)||0<=a.indexOf(e.id))&&g(d.select(this).classed(la,!0),e,f):p(c)&&c&&k(d.select(this).classed(la,
!1),e,f)})};f.unselect=function(a,b){ja&&k.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?Ib:Pc;(t(b)||0<=b.indexOf(e))&&ka(c)&&(ua||t(a)||0<=a.indexOf(c.id))&&f(d.select(this).classed(la,!1),c,e)})};f.toLine=function(a){Ra(a,"line");B()};f.toSpline=function(a){Ra(a,"spline");B()};f.toBar=function(a){Ra(a,"bar");B()};f.toScatter=function(a){Ra(a,"scatter");B()};f.groups=function(a){if(t(a))return u;u=a;B();return u};f.regions=function(a){if(t(a))return O;
O=a;B();return O};f.regions.add=function(a){if(t(a))return O;O=O.concat(a);B();return O};f.regions.remove=function(a,b){var c=[].concat(a);b=p(b)?b:{};c.forEach(function(a){var c=d.selectAll("."+a);p(b.duration)&&(c=c.transition().duration(b.duration).style("fill-opacity",0));c.remove();O=O.filter(function(b){return 0>b.classes.indexOf(a)})});return O};f.data.get=function(a){a=f.data.getAsTarget(a);return p(a)?a.values.map(function(a){return a.value}):void 0};f.data.getAsTarget=function(a){var b=
jb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};f.destroy=function(){f.data.targets=void 0;f.data.x={};pb.html("");T.onresize=null};if("url"in ca.data)d.csv(ca.data.url,function(a,b){Mb(b)});else if("rows"in ca.data)Mb(rc(ca.data.rows));else if("columns"in ca.data)Mb(sc(ca.data.columns));else throw Error("url or rows or columns is required.");return f}})(window);