Browse Source

Fix tooltip position

pull/57/head
Masayuki Tanaka 11 years ago
parent
commit
d61c901227
  1. 16
      c3.js
  2. 183
      c3.min.js

16
c3.js

@ -1063,17 +1063,23 @@
tHeight = tooltip.property('offsetHeight');
// Determin tooltip position
if (__axis_rotated) {
tooltipLeft = mouse[0];
tooltipLeft = mouse[0] + 100;
tooltipRight = tooltipLeft + tWidth;
chartRight = getCurrentWidth() - getCurrentPaddingRight();
tooltipTop = x(dataToShow[0].x) + 20;
} else {
svgLeft = getSvgLeft();
tooltipLeft = svgLeft + getCurrentPaddingLeft() + x(dataToShow[0].x) + 20;
tooltipRight = tooltipLeft + tWidth;
chartRight = svgLeft + getCurrentWidth() - getCurrentPaddingRight();
if (tooltipRight > chartRight) {
tooltipLeft -= tWidth + 30;
}
tooltipTop = mouse[1] + 15;
}
if (tooltipRight > chartRight) {
tooltipLeft -= tWidth + 60;
}
if (tooltipTop + tHeight > getCurrentHeight()) {
tooltipTop -= tHeight + 30;
}
tooltipTop = mouse[1] + 15 + tHeight < getCurrentHeight() ? mouse[1] + 15 : mouse[1] - tHeight;
// Set tooltip
// todo get rid of magic numbers
tooltip

183
c3.min.js vendored

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

Loading…
Cancel
Save