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

2 lines
82 KiB

(function(e){"use strict";function r(e){return e||e===0}function i(e){return typeof e==="undefined"}function s(e){return typeof e!=="undefined"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.round(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.round(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function g(e){var t,n,r=[];if(e.ticks&&f!=undefined){return e.ticks.apply(e,f)}n=e.domain();for(t=Math.ceil(n[0]);t<n[1];t++){r.push(t)}if(r.length>0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e<h.length?h[e]:e;return a?a(n):n}function w(a){a.each(function(){function P(e){var t=n(e)+l;return C[0]<t&&t<C[1]?i:0}var a=e.select(this);var f=this.__chart__||n,c=this.__chart__=y();var h=u?u:g(c),w=a.selectAll(".tick").data(h,c),E=w.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),S=e.transition(w.exit()).style("opacity",1e-6).remove(),x=e.transition(w).style("opacity",1),T,N;var C=n.rangeExtent?n.rangeExtent():m(n.range()),k=a.selectAll(".domain").data([0]),L=(k.enter().append("path").attr("class","domain"),e.transition(k));E.append("line");E.append("text");var A=E.select("line"),O=x.select("line"),M=w.select("text").text(b),_=E.select("text"),D=x.select("text");if(t){l=Math.round((c(1)-c(0))/2);N=p?0:l}else{l=N=0}switch(r){case"bottom":{T=d;A.attr("y2",i);_.attr("y",Math.max(i,0)+o);O.attr("x1",N).attr("x2",N).attr("y2",P);D.attr("x",0).attr("y",Math.max(i,0)+o);M.attr("dy",".71em").style("text-anchor","middle");L.attr("d","M"+C[0]+","+s+"V0H"+C[1]+"V"+s);break};case"top":{T=d;A.attr("y2",-i);_.attr("y",-(Math.max(i,0)+o));O.attr("x2",0).attr("y2",-i);D.attr("x",0).attr("y",-(Math.max(i,0)+o));M.attr("dy","0em").style("text-anchor","middle");L.attr("d","M"+C[0]+","+ -s+"V0H"+C[1]+"V"+ -s);break};case"left":{T=v;A.attr("x2",-i);_.attr("x",-(Math.max(i,0)+o));O.attr("x2",-i).attr("y2",0);D.attr("x",-(Math.max(i,0)+o)).attr("y",l);M.attr("dy",".32em").style("text-anchor","end");L.attr("d","M"+ -s+","+C[0]+"H0V"+C[1]+"H"+ -s);break};case"right":{T=v;A.attr("x2",i);_.attr("x",Math.max(i,0)+o);O.attr("x2",i).attr("y2",0);D.attr("x",Math.max(i,0)+o).attr("y",0);M.attr("dy",".32em").style("text-anchor","start");L.attr("d","M"+s+","+C[0]+"H0V"+C[1]+"H"+s);break}}if(c.rangeBand){var H=c,B=H.rangeBand()/2;f=c=function(e){return H(e)+B}}else if(f.rangeBand){f=c}else{S.call(T,c)}E.call(T,f);x.call(T,c)})}var n=e.scale.linear(),r="bottom",i=6,s=6,o=3,u=null,a,f;var l=0,c=true;var h=[],p;w.scale=function(e){if(!arguments.length){return n}n=e;return w};w.orient=function(e){if(!arguments.length){return r}r=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom";return w};w.tickFormat=function(e){if(!arguments.length){return a}a=e;return w};w.tickCentered=function(e){if(!arguments.length){return p}p=e;return w};w.tickOffset=function(){return l};w.ticks=function(){if(!arguments.length){return f}f=arguments;return w};w.tickCulling=function(e){if(!arguments.length){return c}c=e;return w};w.tickValues=function(e){if(!arguments.length){return u}u=e;return w};w.categories=function(e){if(!arguments.length){return h}h=e;return w};return w}var t={version:"0.1.41"};var n={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",gaugeArc:"c3-gauge-arc",gaugeArcs:"c3-gauge-arcs",gaugeArcsTitle:"c3-gauge-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",step:"c3-step",steps:"c3-steps",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};t.generate=function(t){function l(e,n){if(!(e in t)){throw Error(n)}}function c(e,n){var r=t,i,s,o;for(i=0;i<e.length;i++){if(typeof r==="object"&&!(e[i]in r)){return n}s=i===e.length-1;o=r[e[i]];if(!s&&typeof o!=="object"){return n}r=o}return r}function fi(t){var n=e.navigator.appVersion.toLowerCase().indexOf("msie 9.")>=0;return"url("+(n?"":document.URL.split("#")[0])+"#"+t+")"}function li(e){return Math.ceil(e)+.5}function ci(e,t){var r,i,s;if(t&&t.axisX){r=t.axisX}else{r=Rf.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=Rf.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=Rf.select("."+n.axisY2);if(e){s=s.transition()}}Rf.attr("transform",ri.main);r.attr("transform",ri.x);i.attr("transform",ri.y);s.attr("transform",ri.y2);Rf.select("."+n.chartArcs).attr("transform",ri.arc)}function hi(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=Uf.select("."+n.axisX);if(e){r=r.transition()}}Uf.attr("transform",ri.context);r.attr("transform",ri.subx)}function pi(e){(e?zf.transition():zf).attr("transform",ri.legend)}function di(e,t){ci(e,t);if(ot){hi(e,t)}pi(e)}function yi(){var e=Ki(),t=Ji(),n=ii?0:e,r=Ca(a.data.targets),i=gt||r?0:Ai("x"),s=ot&&!r?ut+i:0;xr=Si();Tr=xi();if(gt){mr={top:Ai("y2")+Ti(),right:r?0:ki(),bottom:Ai("y")+n+Ni(),left:s+(r?0:Ci())};gr={top:mr.top,right:NaN,bottom:20+n,left:vi}}else{mr={top:4+Ti(),right:r?0:ki(),bottom:i+s+n+Ni(),left:r?0:Ci()};gr={top:Tr-s-n,right:NaN,bottom:i+n,left:mr.left}}yr={top:ii?0:Tr-e,right:NaN,bottom:0,left:ii?xr-t:0};br=xr-mr.left-mr.right;Er=Tr-mr.top-mr.bottom;if(br<0){br=0}if(Er<0){Er=0}wr=gt?mr.left-vi-mi:br;Sr=gt?Er:Tr-gr.top-gr.bottom;if(wr<0){wr=0}if(Sr<0){Sr=0}Lr=br-(ii?t+10:0);Ar=Er-(ii?0:10);wi();if(ii&&r){yr.left=Lr/2+Cr*1.1}}function bi(){Rf.select("line."+n.xgridFocus).attr("x1",gt?0:-10).attr("x2",gt?br:-10).attr("y1",gt?-10:mr.top).attr("y2",gt?-10:Er)}function wi(){Cr=Math.min(Lr,Ar)/2;Nr=Cr*.95;var e=Dn?(Nr-Dn)/Nr:.6;kr=Na(a.data.targets)||Ta(a.data.targets)?Nr*e:0}function Ei(){var e=gt?n.axisX:n.axisY,t=Rf.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=Xf.node().getBoundingClientRect(),s=Ca(a.data.targets),o=r.right-i.left-(s?0:Ci());return o>0?o:0}function Si(){return p?p:Oi()}function xi(){var e=d?d:Mi();return e>0?e:320}function Ti(){return g?g:0}function Ni(){return y?y:0}function Ci(){if(v){return v}else if(gt){return!yt?1:Math.max(rf(Li("x")),40)}else{return!Bt||Rt?1:rf(Li("y"))}}function ki(){var e=10,t=ii?Ji()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:rf(Li("y2")))+t}}function Li(e){var t=gs(e);return t.isInner?20+Bs(e):40+Bs(e)}function Ai(e){if(e==="x"&&!yt){return 0}if(e==="x"&&Dt){return Dt}if(e==="y"&&!Bt){return ct&&!ii?10:1}if(e==="y2"&&!Xt){return gi}return(gs(e).isInner?30:40)+(e==="y2"?-10:0)}function Oi(){return+Xf.style("width").replace("px","")}function Mi(){return+Xf.style("height").replace("px","")}function _i(e){return e?-(1+30):-(mr.left-1)}function Di(e){return e?-20:-4}function Pi(){return _i(!gt)}function Hi(){return Di(!gt)}function Bi(){return _i(gt)}function ji(){return Di(gt)}function Fi(e){return e?br+2+30+30:mr.left+20}function Ii(e){return e?(Dt?Dt:0)+80:Er+8}function qi(){return Fi(!gt)}function Ri(){return Ii(!gt)}function Ui(){return Fi(gt)}function zi(){return Ii(gt)}function Wi(){var e=Po(a.data.targets),t,n,r,i,s;if(!e){return 0}t=e.values[0],n=e.values[e.values.length-1];r=Ur(n.x)-Ur(t.x);if(r===0){return gt?Er:br}i=Do();s=Ea(a.data.targets)?(i-(nr?.25:1))/i:1;return i>1?r*s/(i-1):r}function Xi(e){si=e}function Vi(e){oi=e}function $i(e){ui=e}function Ji(){return ct?ii?oi*(si+1):xr:0}function Ki(){return ct?ii?Tr:ui*(si+1):0}function Qi(){var e,t,n=!Ur;Pr=gt?1:0;Hr=gt?Er:br;Br=gt?0:Er;jr=gt?br:1;Fr=Pr;Ir=Hr;qr=gt?0:Sr;Rr=gt?wr:1;Ur=Zi(Pr,Hr,n?undefined:Ur.domain(),function(){return Jr.tickOffset()});zr=es(Br,jr,n?undefined:zr.domain());Wr=es(Br,jr,n?undefined:Wr.domain());Xr=Zi(Pr,Hr,Vf,function(e){return e%1?0:Gr.tickOffset()});Vr=es(qr,Rr,n?undefined:Vr.domain());$r=es(qr,Rr,n?undefined:$r.domain());e=os();t=Lt?Lt:n?undefined:Jr.tickValues();Jr=rs(Ur,Zr,e,t);Gr=rs(Xr,ni,e,t);Kr=is(zr,ei,Ut,Wt);Qr=is(Wr,ti,Gt,Zt);if(!n){jf.scale(Xr);if(b){Ff.scale(Ur)}}Gi()}function Gi(){Or=Is();Mr=qs();_r=qs(.98)}function Yi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function Zi(e,t,n,r){var i=Yi(e,t,tr),s=n?i.domain(n):i,o;if(nr){r=r||function(){return 0};i=function(e,t){var n=s(e)+r(e);return t?n:Math.ceil(n)}}else{i=function(e,t){var n=s(e);return t?n:Math.ceil(n)}}for(o in s){i[o]=s[o]}i.orgDomain=function(){var e=s.domain();if(Vf&&Vf[0]===e[0]&&Vf[1]<e[1]){e[1]=Vf[1]}return e};if(nr){i.domain=function(e){if(!arguments.length){e=this.orgDomain();return[e[0],e[1]+1]}s.domain(e);return i}}return i}function es(e,t,n){var r=Yi(e,t);if(n){r.domain(n)}return r}function ts(e){return ss(e)==="y2"?Wr:zr}function ns(e){return ss(e)==="y2"?$r:Vr}function rs(e,t,n,r){var i=o(u,nr).scale(e).orient(t);i.tickFormat(n).tickValues(r);if(nr){i.tickCentered(St);if(Ga(Tt)){Tt=false}i.categories(Et)}else{i.tickOffset=function(){var e=Ho(a.data.targets),t=Ur(e[1])-Ur(e[0]),n=t?t:gt?Er:br;return n/Do()/2}}return i}function is(e,t,n,r){return o(u).scale(e).orient(t).tickFormat(n).ticks(r)}function ss(e){return e in H?H[e]:"y"}function os(){var e=tr?pr:nr?Yo:function(e){return e<0?e.toFixed(0):e};if(xt){if(typeof xt==="function"){e=xt}else if(tr){e=function(e){return e?hr(xt)(e):""}}}return e}function us(e){var t;if(e==="y"){t=qt}else if(e==="y2"){t=Kt}else if(e==="x"){t=Ht}return t}function as(e){var t=us(e);return typeof t==="string"?t:t?t.text:null}function fs(e,t){var n=us(e);if(typeof n==="string"){if(e==="y"){qt=t}else if(e==="y2"){Kt=t}else if(e==="x"){Ht=t}}else if(n){n.text=t}}function ls(e){return 10*Math.sin(Math.PI*(e/180))}function cs(e){return 11.5-2.5*(e/15)}function hs(e,t,n){e.selectAll(".tick text").style("text-anchor","start");t.selectAll(".tick text").attr("y",cs(n)).attr("x",ls(n)).attr("transform","rotate("+n+")")}function ps(e,t){var n=us(e),r=n&&typeof n==="object"&&n.position?n.position:t;return{isInner:r.indexOf("inner")>=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}}function ds(){return ps("x",gt?"inner-top":"inner-right")}function vs(){return ps("y",gt?"inner-right":"inner-top")}function ms(){return ps("y2",gt?"inner-right":"inner-top")}function gs(e){return e==="y2"?ms():e==="y"?vs():ds()}function ys(){return as("x")}function bs(){return as("y")}function ws(){return as("y2")}function Es(e,t){if(e){return t.isLeft?0:t.isCenter?br/2:br}else{return t.isBottom?-Er:t.isMiddle?-Er/2:0}}function Ss(e,t){if(e){return t.isLeft?"0.5em":t.isRight?"-0.5em":"0"}else{return t.isTop?"-0.5em":t.isBottom?"0.5em":"0"}}function xs(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ts(){return Es(!gt,ds())}function Ns(){return Es(gt,vs())}function Cs(){return Es(gt,ms())}function ks(){return Ss(!gt,ds())}function Ls(){return Ss(gt,vs())}function As(){return Ss(gt,ms())}function Os(){var e=ds();if(gt){return e.isInner?"1.2em":-25-Bs("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function Ms(){var e=vs();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-Bs("y")}}function _s(){var e=ms();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+Bs("y2")}}function Ds(){return xs(!gt,ds())}function Ps(){return xs(gt,vs())}function Hs(){return xs(gt,ms())}function Bs(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;u.selectAll("."+r+" .tick text").each(function(){var e=this.getBoundingClientRect();if(t<e.width){t=e.width}});return t<0?0:t}function js(e){var t=Rf.select("."+n.axisX+" ."+n.axisXLabel),r=Rf.select("."+n.axisY+" ."+n.axisYLabel),i=Rf.select("."+n.axisY2+" ."+n.axisY2Label);(e?t.transition():t).attr("x",Ts).attr("dx",ks).attr("dy",Os).text(ys);(e?r.transition():r).attr("x",Ns).attr("dx",Ls).attr("dy",Ms).attr("dy",Ms).text(bs);(e?i.transition():i).attr("x",Cs).attr("dx",As).attr("dy",_s).text(ws)}function Fs(e){var t=false;Dr(Ro(a.data.targets)).forEach(function(n){if(!t&&n.data.id===e.data.id){t=true;e=n;return}});if(isNaN(e.endAngle))e.endAngle=e.startAngle;if(Pa(e.data)){var n=e.startAngle,r=e.endAngle;var i=kn,s=Cn,o=Math.abs(i)+s,u=Math.abs(n)+r,f=Math.PI/o;e.startAngle=-1*(Math.PI/2)+f*Math.abs(i);e.endAngle=e.startAngle+f*(e.value>s?s:e.value)}return t?e:null}function Is(){var e=u.svg.arc().outerRadius(Nr).innerRadius(kr),t=function(t,n){var r;if(n){return e(t)}r=Fs(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function qs(e){var t=u.svg.arc().outerRadius(Cr*(e?e:1)).innerRadius(kr);return function(e){var n=Fs(e);return n?t(n):"M 0 0"}}function Rs(e,t){return Ba(e.data)?Or(e,t):"M 0 0"}function Us(e){var t=Fs(e),n,r,i,s,o="";if(t){n=Or.centroid(t);r=n[0],i=n[1],s=Math.sqrt(r*r+i*i);o=Mn=="arc"?"translate(1,1)":"translate("+r/s*Nr*.8+","+i/s*Nr*.8+")"}return o}function zs(e){var t=Mn=="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Ws(e){return xo({id:e.data.id,value:e.value,ratio:zs(e)})}function Xs(e){var t,n,r,i;if(!Js()){return""}t=Fs(e);n=t?t.value:null;r=zs(t);i=Ks();return i?i(n,r):Fu(n,r)}function Vs(e,t){var r=If.selectAll("."+n.chartArc+Tu(e)),i=If.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Wa(e)){r.selectAll("path").transition().duration(50).attr("d",Mr).transition().duration(100).attr("d",_r).each(function(e){if(Ha(e.data)){}})}if(!t){i.style("opacity",.3)}}function $s(e){var t=If.selectAll("."+n.chartArc+Tu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Or);If.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Js(){if(Ta(a.data.targets)){return true}return Na(a.data.targets)?Pn:gn}function Ks(){if(Ta(a.data.targets)){return Nn}return Na(a.data.targets)?Hn:yn}function Qs(){return Na(a.data.targets)?jn:""}function Gs(){if(Ta(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Na(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Ys(){if(Ta(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Na(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function Zs(){if(Ta(a.data.targets)){return typeof On==="function"?On:function(){}}var e=Na(a.data.targets)?qn:Sn;return typeof e==="function"?e:function(){}}function eo(e){var t=Bo(e),n=Jo(e),r,i,s,o,a,f;if(P.length>0){f=Qo(e);for(r=0;r<P.length;r++){o=P[r].filter(function(e){return t.indexOf(e)>=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i<o.length;i++){a=o[i];if(!n[a]){continue}n[a].forEach(function(e,t){if(ss(a)===ss(s)&&n[s]&&!(f&&+e>0)){n[s][t]+=+e}})}}}return u.min(Object.keys(n).map(function(e){return u.min(n[e])}))}function to(e){var t=Bo(e),n=Jo(e),r,i,s,o,a,f;if(P.length>0){f=Go(e);for(r=0;r<P.length;r++){o=P[r].filter(function(e){return t.indexOf(e)>=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i<o.length;i++){a=o[i];if(!n[a]){continue}n[a].forEach(function(e,t){if(ss(a)===ss(s)&&n[s]&&!(f&&+e<0)){n[s][t]+=+e}})}}}return u.max(Object.keys(n).map(function(e){return u.max(n[e])}))}function no(e,t){var n=e.filter(function(e){return ss(e.id)===t}),i=t==="y2"?$t:Ft,s=t==="y2"?Vt:jt,o=r(i)?i:eo(n),u=r(s)?s:to(n),a,f,l,c,h=t==="y2"?Jt:It,p,d,v,m,g=_u()&&gt;if(n.length===0){return t==="y2"?Wr.domain():zr.domain()}if(o===u){o<0?u=0:o=0}a=Math.abs(u-o);f=l=c=g?0:a*.1;if(h){p=Math.max(Math.abs(o),Math.abs(u));u=p-h;o=h-p}if(g){d=Du(o,u);v=uo(zr.range());m=[d[0]/v,d[1]/v];l+=a*(m[1]/(1-m[0]-m[1]));c+=a*(m[0]/(1-m[0]-m[1]))}if(t==="y"&&zt){l=r(zt.top)?zt.top:f;c=r(zt.bottom)?zt.bottom:f}if(t==="y2"&&Yt){l=r(Yt.top)?Yt.top:f;c=r(Yt.bottom)?Yt.bottom:f}if(Ea(n)&&!Qo(n)){c=o}if(en&&!Qo(n)){c-=c}return[o-c,u+l]}function ro(e){return Mt?tr?$a(Mt):Mt:u.min(e,function(e){return u.min(e.values,function(e){return e.x})})}function io(e){return Ot?tr?$a(Ot):Ot:u.max(e,function(e){return u.max(e.values,function(e){return e.x})})}function so(e){var t=Ho(e),n=t[1]-t[0],i,s,o,u;if(nr){s=0}else if(Ea(e)){i=Do();s=i>1?n/(i-1)/2:.5}else if(en){s=n*.001}else{s=n*.01}if(typeof _t==="object"&&Ya(_t)){o=r(_t.left)?_t.left:s;u=r(_t.right)?_t.right:s}else if(typeof _t==="number"){o=u=_t}else{o=u=s}return{left:o,right:u}}function oo(e){var t=[ro(e),io(e)],n=t[0],r=t[1],i=so(e),s=0,o=0;if(n-r===0&&!nr){n=tr?new Date(n.getTime()*.5):-.5;r=tr?new Date(r.getTime()*1.5):.5}if(n||n===0){s=tr?new Date(n.getTime()-i.left):n-i.left}if(r||r===0){o=tr?new Date(r.getTime()+i.right):r+i.right}return[s,o]}function uo(e){return e[1]-e[0]}function ao(e){for(var t=0;t<e.length;t++){if(!(e[t]in f)){return false}}return true}function fo(e,t){f[e]=Oo(t)}function lo(e){var t=[];for(var n=0;n<e.length;n++){if(e[n]in f){t.push(Oo(f[e[n]]))}}return t}function co(e){var t,n=e.axis==="y"?zr:Wr;if(e.axis==="y"||e.axis==="y2"){t=gt?"start"in e?n(e.start):0:0}else{t=gt?0:"start"in e?Ur(tr?$a(e.start):e.start):0}return t}function ho(e){var t,n=e.axis==="y"?zr:Wr;if(e.axis==="y"||e.axis==="y2"){t=gt?0:"end"in e?n(e.end):0}else{t=gt?"start"in e?Ur(tr?$a(e.start):e.start):0:0}return t}function po(e){var t=co(e),n,r=e.axis==="y"?zr:Wr;if(e.axis==="y"||e.axis==="y2"){n=gt?"end"in e?r(e.end):br:br}else{n=gt?br:"end"in e?Ur(tr?$a(e.end):e.end):br}return n<t?0:n-t}function vo(e){var t=ho(e),n,r=e.axis==="y"?zr:Wr;if(e.axis==="y"||e.axis==="y2"){n=gt?Er:"start"in e?r(e.start):Er}else{n=gt?"end"in e?Ur(tr?$a(e.end):e.end):Er:Er}return n<t?0:n-t}function mo(e){return L&&e===L||Ya(A)&&Za(A,e)}function go(e){return!mo(e)}function yo(e){return L?L:Ya(A)?A[e]:null}function bo(e,t){var n,r=t&&Ya(t)?Bo(t):[];r.forEach(function(t){if(yo(t)===e){n=a.data.xs[t]}});return n}function wo(e,t){return e in a.data.xs&&a.data.xs[e]&&a.data.xs[e][t]?a.data.xs[e][t]:t}function Eo(e){Object.keys(e).forEach(function(t){A[t]=e[t]})}function So(e){return u.set(Object.keys(e).map(function(t){return e[t]})).size()===1}function xo(e){var t;if(e){t=_[e.id];e.name=t?t:e.id}return e}function To(e,t){e.forEach(function(e){e.values.forEach(function(n,r){n.x=Co(t[r],e.id,r)});a.data.xs[e.id]=t})}function No(e,t){e.forEach(function(e){if(t[e.id]){To([e],t[e.id])}})}function Co(e,t,n){var i;if(tr){i=e?e instanceof Date?e:$a(e):$a(wo(t,n))}else if(rr&&!nr){i=r(e)?+e:wo(t,n)}else{i=n}return i}function ko(e){var t=e[0],n={},r=[],i,s;for(i=1;i<e.length;i++){n={};for(s=0;s<e[i].length;s++){n[t[s]]=e[i][s]}r.push(n)}return r}function Lo(e){var t=[],n,r,s;for(n=0;n<e.length;n++){s=e[n][0];for(r=1;r<e[n].length;r++){if(i(t[r-1])){t[r-1]={}}t[r-1][s]=e[n][r]}}return t}function Ao(e){var t=u.keys(e[0]).filter(go),n=u.keys(e[0]).filter(mo),i;t.forEach(function(t){var i=yo(t),s;if(rr||tr){if(n.indexOf(i)>=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r)}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Ya(A)){a.data.xs[t]=bo(i,a.data.targets)}}else{a.data.xs[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!a.data.xs[e]){throw new Error('x is not defined for id = "'+e+'".')}});i=t.map(function(t,n){var r=M(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=yo(t),o=e[s],u=Co(o,t,i);if(rr&&nr&&n===0&&o){if(i===0){Et=[]}Et.push(o)}if(typeof e[t]==="undefined"||a.data.xs[t].length<=i){u=undefined}return{x:u,value:e[t]!==null&&!isNaN(e[t])?+e[t]:null,id:r}}).filter(function(e){return typeof e.x!=="undefined"})}});i.forEach(function(e){var t;e.values=e.values.sort(function(e,t){var n=e.x||e.x===0?e.x:Infinity,r=t.x||t.x===0?t.x:Infinity;return n-r});t=0;e.values.forEach(function(e){e.index=t++})});if(B){ba(Bo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){fo(e.id_org,e)});return i}function Oo(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}}function Mo(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function _o(e){return e<Do()-1?a.data.targets[0].values[e+1].x:undefined}function Do(){return u.max(a.data.targets,function(e){return e.values.length})}function Po(e){var t=e.length,n=0,r;if(t>1){e.forEach(function(e){if(e.values.length>n){r=e;n=e.values.length}})}else{r=t?e[0]:null}return r}function Ho(e){var t=Po(e),n,r;if(!t){return[0,0]}n=t.values[0],r=t.values[t.values.length-1];return[n.x,r.x]}function Bo(e){return e.map(function(e){return e.id})}function jo(e){return e?typeof e==="string"?[e]:e:Bo(a.data.targets)}function Fo(e,t){var n=Bo(e),r;for(r=0;r<n.length;r++){if(n[r]===t){return true}}return false}function Io(e){return dr.indexOf(e)<0}function qo(e){return vr.indexOf(e)<0}function Ro(e){return e.filter(function(e){return Io(e.id)})}function Uo(e){var t=u.set(u.merge(e.map(function(e){return e.values.map(function(e){return e.x})}))).values();return tr?t.map(function(e){return new Date(e)}):t.map(function(e){return+e})}function zo(e,t){var n=e,r,i,s,o,u,a,f;if(t){r=typeof t==="function"?t():t;if(r===1){n=[e[0]]}else if(r===2){n=[e[0],e[e.length-1]]}else if(r>2){o=r-2;i=e[0];s=e[e.length-1];u=(s-i)/(o+1);n=[i];for(a=0;a<o;a++){f=+i+u*(a+1);n.push(tr?new Date(f):f)}n.push(s)}}if(!tr){n=n.sort(function(e,t){return e-t})}return n}function Wo(e){dr=dr.concat(e)}function Xo(e){dr=dr.filter(function(t){return e.indexOf(t)<0})}function Vo(e){vr=vr.concat(e)}function $o(e){vr=vr.filter(function(t){return e.indexOf(t)<0})}function Jo(e){var t={};e.forEach(function(e){t[e.id]=[];e.values.forEach(function(n){t[e.id].push(n.value)})});return t}function Ko(e,t){var n=Object.keys(e),r,i,s;for(r=0;r<n.length;r++){s=e[n[r]].values;for(i=0;i<s.length;i++){if(t(s[i].value)){return true}}}return false}function Qo(e){return Ko(e,function(e){return e<0})}function Go(e){return Ko(e,function(e){return e>0})}function Yo(e){return e<Et.length?Et[e]:e}function Zo(e,t){return" "+e+" "+e+xu(t)}function eu(e){return Zo(n.text,e.id)}function tu(e){return Zo(n.texts,e.id)}function nu(e,t){return Zo(n.shape,t)}function ru(e){return Zo(n.shapes,e.id)}function iu(e){return nu(e)+Zo(n.line,e.id)}function su(e){return ru(e)+Zo(n.lines,e.id)}function ou(e,t){return nu(e,t)+Zo(n.circle,t)}function uu(e){return ru(e)+Zo(n.circles,e.id)}function au(e,t){return nu(e,t)+Zo(n.bar,t)}function fu(e){return ru(e)+Zo(n.bars,e.id)}function lu(e){return nu(e.data)+Zo(n.arc,e.data.id)}function cu(e){return ru(e.data)+Zo(n.arcs,e.data.id)}function hu(e){return nu(e)+Zo(n.area,e.id)}function pu(e){return ru(e)+Zo(n.areas,e.id)}function du(e,t){return Zo(n.region,t)+" "+("class"in e?e.class:"")}function vu(e,t){return Zo(n.eventRect,t)}function mu(e){return nu(e)+Zo(n.step,e.id)}function gu(e){return ru(e)+Zo(n.steps,e.id)}function yu(e){var t=D[e],r="";if(t){r=" "+n.target+"-"+t}return Zo(n.target,e)+r}function bu(e){return n.chartText+yu(e.id)}function wu(e){return n.chartLine+yu(e.id)}function Eu(e){return n.chartBar+yu(e.id)}function Su(e){return n.chartArc+yu(e.data.id)}function xu(e){return e||e===0?"-"+(e.replace?e.replace(/([^a-zA-Z0-9-_])/g,"-"):e):""}function Tu(e){return"."+n.target+xu(e)}function Nu(e){return e.length?e.map(function(e){return Tu(e)}):null}function Cu(e){return"."+n.legendItem+xu(e)}function ku(e){return e.length?e.map(function(e){return Cu(e)}):null}function Lu(e){return e.value!==null&&Jf[e.id]?1:0}function Au(e){var t=Mu(e);return Lu(e)*t}function Ou(e){return r(e.value)?_a(e)?.5:1:0}function Mu(){return _u()?1:0}function _u(){if(typeof F==="boolean"&&F){return true}else if(typeof F==="object"&&Ya(F)){return true}return false}function Du(e,t){var n=[],r=1.3;Xf.select("svg").selectAll(".dummy").data([e,t]).enter().append("text").text(function(e){return e}).each(function(e,t){n[t]=this.getBoundingClientRect().width*r}).remove();return n}function Pu(e){var t=e&&!Ta(a.data.targets)?Fu:Hu,n=e&&!Ta(a.data.targets)?Fu:Bu;return function(e,r,i){var s=ss(i)==="y2"?n:t;return s(e,r)}}function Hu(e){var t=Ut?Ut:ju;return t(e)}function Bu(e){var t=Gt?Gt:ju;return t(e)}function ju(e){return r(e)?+e:""}function Fu(e,t){return(t*100).toFixed(1)+"%"}function Iu(e){var t=function(e){return r(e)?+e:""},n=ss(e),i=t;if(typeof F.format==="function"){i=F.format}else if(typeof F.format==="object"){if(typeof F.format[n]==="function"){i=F.format[n]}}return i}function qu(e){return e?Ur(e.x):null}function Ru(e){return Math.ceil(Ur(tr?$a(e.value):e.value))}function Uu(e){var t=e.axis&&e.axis==="y2"?Wr:zr;return Math.ceil(t(e.value))}function zu(e){return Xr(e.x)}function Wu(e,t){var n,r=e[t].x,i=[];for(n=t-1;n>=0;n--){if(r!==e[n].x){break}i.push(e[n])}for(n=t;n<e.length;n++){if(r!==e[n].x){break}i.push(e[n])}return i}function Xu(e,t,n,r){var i=n?n:0,s=r?r:e.length-1,o=Math.floor((s-i)/2)+i,u=e[o],a=Ur(u.x)-t[gt?1:0],f;a>0?s=o:i=o;if(s-i===1||i===0&&s===0){f=[];if(e[i].x||e[i].x===0){f=f.concat(Wu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Wu(e,s))}return $u(f,t)}return Xu(e,t,i,s)}function Vu(e,t){var n;n=e.map(function(e){return Xu(e.values,t)});return $u(n,t)}function $u(e,t){var n,r;e.forEach(function(e){var i=ef(e,t);if(i<n||!n){n=i;r=e}});return r}function Ju(e,t){return u.merge(e.map(function(e){return e.values})).filter(function(e){return e.x-t===0})}function Ku(e){var t=e.getBoundingClientRect(),n=[e.pathSegList.getItem(0),e.pathSegList.getItem(1)],r=n[0].x,i=Math.min(n[0].y,n[1].y);return{x:r,y:i,width:t.width,height:t.height}}function Qu(){return I&&I.toLowerCase()==="desc"}function Gu(){return I&&I.toLowerCase()==="asc"}function Yu(e){var t=Gu(),n=Qu();if(t||n){e.sort(function(e,n){var r=function(e,t){return e+Math.abs(t.value)};var i=e.values.reduce(r,0),s=n.values.reduce(r,0);return t?s-i:i-s})}else if(typeof I==="function"){e.sort(I)}return e}function Zu(e,t){var n,i,s,o,u,f,l;var c=Ca(a.data.targets),h=e.filter(function(e){return e&&r(e.value)});if(h.length===0||!Un){return}Wf.html(Xn(e,os(),Pu(c),lr)).style("display","block");n=Wf.property("offsetWidth");i=Wf.property("offsetHeight");if(c){o=br/2+t[0];f=Er/2+t[1]+20}else{if(gt){s=Ei();o=s+t[0]+100;u=o+n;l=Si()-ki();f=Ur(h[0].x)+20}else{s=Ei();o=s+Ci()+Ur(h[0].x)+20;u=o+n;l=s+Si()-ki();f=t[1]+15}if(u>l){o-=n+60}if(f+i>xi()){f-=i+30}}Wf.style("top",f+"px").style("left",o+"px")}function ea(){Wf.style("display","none")}function ta(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Un){return}if(Sa(a.data.targets)||Ca(a.data.targets)){return}var i=Rf.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",qu).attr(gt?"y2":"x2",qu);nl(i,"grid")}function na(){Rf.select("line."+n.xgridFocus).style("visibility","hidden")}function ra(e,t){var r=[],i,s,o,u,a=Rf.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=oo();s=i[0].getFullYear();o=i[1].getFullYear();for(u=s;u<=o;u++){r.push(new Date(u+"-01-01 00:00:00"))}}else{r=t.ticks(10)}return r.slice(0,a)}function ia(e){return e.x||e.x===0?Ur(e.x):null}function sa(e,t){var n=va(),r=Df(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ts(e.id)(e.value)}function oa(){var e={},t=0,n,r;Ro(a.data.targets.filter(Ma)).forEach(function(s){for(n=0;n<P.length;n++){if(P[n].indexOf(s.id)<0){continue}for(r=0;r<P[n].length;r++){if(P[n][r]in e){e[s.id]=e[P[n][r]];break}}}if(i(e[s.id])){e[s.id]=t++}});e.__max__=t-1;return e}function ua(e,t,n,r){var i=r?Xr:Ur;return function(r){var s=r.id in n?n[r.id]:0;return r.x||r.x===0?i(r.x)-e*(t/2-s):0}}function aa(e){return function(t){var n=e?ns(t.id):ts(t.id);return n(t.value)}}function fa(e,t){var n=Yu(Ro(a.data.targets.filter(Ma))),r=n.map(function(e){return e.id});return function(i,s){var o=t?ns(i.id):ts(i.id),u=o(0),a=u;n.forEach(function(t){if(t.id===i.id||e[t.id]!==e[i.id]){return}if(r.indexOf(t.id)<r.indexOf(i.id)&&t.values[s].value*i.value>0){a+=o(t.values[s].value)-u}});return a}}function la(e,t){return typeof vn==="number"?vn:t?e.tickOffset()*2*mn/t:0}function ca(){var e={},t=0,n,r;Ro(a.data.targets.filter(Oa)).forEach(function(s){for(n=0;n<P.length;n++){if(P[n].indexOf(s.id)<0){continue}for(r=0;r<P[n].length;r++){if(P[n][r]in e){e[s.id]=e[P[n][r]];break}}}if(i(e[s.id])){e[s.id]=t++}});e.__max__=t-1;return e}function ha(e,t,n){var r=n?Xr:Ur;return function(n){var i=n.id in t?t[n.id]:0;return n.x||n.x===0?r(n.x)-0*(e/2-i):0}}function pa(e){return function(t){var n=e?ns(t.id):ts(t.id);return n(t.value)}}function da(e,t){var n=Yu(Ro(a.data.targets.filter(Oa))),r=n.map(function(e){return e.id});return function(i,s){var o=t?ns(i.id):ts(i.id),u=o(0),a=u;n.forEach(function(t){if(t.id===i.id||e[t.id]!==e[i.id]){return}if(r.indexOf(t.id)<r.indexOf(i.id)&&t.values[s].value>0){a+=o(t.values[s].value)-u}});return a}}function va(){var e={},t=0,n,r;Ro(a.data.targets.filter(ka)).forEach(function(s){for(n=0;n<P.length;n++){if(P[n].indexOf(s.id)<0){continue}for(r=0;r<P[n].length;r++){if(P[n][r]in e){e[s.id]=e[P[n][r]];break}}}if(i(e[s.id])){e[s.id]=t++}});e.__max__=t-1;return e}function ma(e,t,n){var r=n?Xr:Ur;return function(n){var i=n.id in t?t[n.id]:0;return n.x||n.x===0?r(n.x)-0*(e/2-i):0}}function ga(e){return function(t){var n=e?ns(t.id):ts(t.id);return n(t.value)}}function ya(e,t){var n=Yu(Ro(a.data.targets.filter(ka))),r=n.map(function(e){return e.id});return function(i,s){var o=t?ns(i.id):ts(i.id),u=o(0),a=u;n.forEach(function(t){if(t.id===i.id||e[t.id]!==e[i.id]){return}if(r.indexOf(t.id)<r.indexOf(i.id)&&t.values[s].value>0){a+=o(t.values[s].value)-u}});return a}}function ba(e,t){jo(e).forEach(function(e){Jf[e]=t===j[e];j[e]=t})}function wa(e,t){var n=false;e.forEach(function(e){if(j[e.id]===t){n=true}if(!(e.id in j)&&t==="line"){n=true}});return n}function Ea(e){return wa(e,"bar")}function Sa(e){return wa(e,"scatter")}function xa(e){return wa(e,"pie")}function Ta(e){return wa(e,"gauge")}function Na(e){return wa(e,"donut")}function Ca(e){return xa(e)||Na(e)||Ta(e)}function ka(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="line"||j[t]==="spline"||j[t]==="area"||j[t]==="area-spline"}function La(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Aa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function Ba(e){return Da(e)||Ha(e)||Pa(e)}function ja(e){return ka(e)?[e]:[]}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Ba(e.data)?[e]:[]}function qa(e){return Ma(e)?e.values:[]}function Ra(e){return ka(e)||_a(e)?e.values:[]}function Ua(e){return ka(e)||La(e)?[e]:[]}function za(e){return Ma(e)||ka(e)?e.values:[]}function Wa(e){return Ha(e)&&Bn||Da(e)&&bn}function Xa(e,t,n){var r=[];return function(i){var s=i.id||i,o;if(e[s]instanceof Function){o=e[s](i)}else if(e[s]){o=e[s]}else{if(r.indexOf(s)<0){r.push(s)}o=t[r.indexOf(s)%t.length]}return n instanceof Function?n(o,i):o}}function Va(e,t){var n=e,r=t;return function(e){for(var t=1;t<r.length;t++){if(r[0]==="percentage"&&e/Cn*100<r[t]){return n[t-1]}if(r[0]==="whole"&&e<r[t]){return n[t-1]}}return n[n.length-1]}}function $a(t){var n;try{n=O?u.time.format(O).parse(t):new Date(t)}catch(r){e.console.error("Failed to parse x '"+t+"' to Date with format "+O)}return n}function Ja(e,t){var n=u.mouse(e),r=u.select(e);var i=r.attr("cx")*1,s=r.attr("cy")*1;return Math.sqrt(Math.pow(i-n[0],2)+Math.pow(s-n[1],2))<t}function Ka(e){var t=u.mouse(e),n=e.getBoundingClientRect(),r=e.pathSegList.getItem(0),i=e.pathSegList.getItem(1);var s=r.x,o=Math.min(r.y,i.y),a=n.width,f=n.height,l=2;var c=s-l,h=s+a+l,p=o+f+l,d=o-l;return c<t[0]&&t[0]<h&&d<t[1]&&t[1]<p}function Qa(e,t){var n;for(n=0;n<t.length;n++){if(t[n].start<e&&e<=t[n].end){return true}}return false}function Ga(e){return!e||typeof e==="string"&&e.length===0||typeof e==="object"&&Object.keys(e).length===0}function Ya(e){return Object.keys(e).length>0}function Za(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function ef(e,t){var n=ss(e.id)==="y"?zr:Wr,r=gt?1:0,i=gt?0:1;return Math.pow(Ur(e.x)-t[r],2)+Math.pow(n(e.value)-t[i],2)}function tf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function nf(e,t,n){return s(e[t])?e[t]:n}function rf(e){return Math.ceil(e/10)*10}function sf(e,t,r){Y(t,e.node());Rf.select("."+n.selectedCircles+xu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return Zo(n.selectedCircle,r)}).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa).attr("stroke",function(){return lr(t)}).attr("r",mf(t)*1.4).transition().duration(100).attr("r",mf)}function of(e,t,r){Z(t,e.node());Rf.select("."+n.selectedCircles+xu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function uf(e,t,n,r){e?sf(t,n,r):of(t,n,r)}function af(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(lr(t)).brighter(.75)})}function ff(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return lr(t)})}function lf(e,t,n,r){e?af(t,n,r):ff(t,n,r)}function cf(e,t,n,r){lf(e,t,n.data,r)}function hf(e){return e.nodeName==="circle"?uf:u.select(e).classed(n.bar)?lf:cf}function pf(e){return e.filter(function(e){return r(e.value)})}function df(e){return an?typeof fn==="function"?fn(e):fn:0}function vf(e){return cn?hn?hn:df(e)*1.75:df(e)}function mf(e){return pn?pn:df(e)*4}function gf(e,t){return(t?Rf.selectAll("."+n.circles+xu(t)):Rf).selectAll("."+n.circle+(r(e)?"-"+e:""))}function yf(e,t){gf(e,t).classed(n.EXPANDED,true).attr("r",vf)}function bf(e){gf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",df)}function wf(e){return Rf.selectAll("."+n.bar+(r(e)?"-"+e:""))}function Ef(e){wf(e).classed(n.EXPANDED,true)}function Sf(e){wf(e).classed(n.EXPANDED,false)}function Nf(e,t){var n,r=Mf(e,t);if(gt){n=u.svg.area().x0(function(e,t){return ts(e.id)(0)}).x1(function(e,t){return ts(e.id)(e.value)}).y(qu)}else{n=u.svg.area().x(qu).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return ts(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return ts(e.id)(e.value)})}return function(e,t){var r=pf(e.values),i,s;if(wa([e],"area")||wa([e],"area-spline")){Aa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(wa([e],"area-step")){La(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=Ur(r[0].x);s=ts(e.id)(r[0].value);return gt?"M "+s+" "+i:"M "+i+" "+s}}}function Cf(e,t){var n=_f(e,t);return function(e,t){var r=n(e,t);var i=gt?1:0;var s=gt?0:1;var o="M "+r[0][i]+","+r[0][s]+" "+"L"+r[1][i]+","+r[1][s]+" "+"L"+r[2][i]+","+r[2][s]+" "+"L"+r[3][i]+","+r[3][s]+" "+"z";return o}}function kf(e,t){var n=Df(e,t),r=u.svg.line().x(gt?function(e,t){if(P.length>0){var r=n(e,t);return r[0][1]}return ts(e.id)(e.value)}:qu).y(gt?qu:function(e,t){if(P.length>0){var r=n(e,t);return r[0][1]}return ts(e.id)(e.value)});return function(e){var t=pf(e.values),n,i;if(ka(e)){Aa(e)?r.interpolate("cardinal"):r.interpolate("linear");return q[e.id]?Bf(t,Ur,ts(e.id),q[e.id]):r(t)}else if(La(e)){r.interpolate("step-after");return q[e.id]?Bf(t,Ur,ts(e.id),q[e.id]):r(t)}else{n=Ur(t[0].x);i=ts(e.id)(t[0].value);return gt?"M "+i+" "+n:"M "+n+" "+i}}}function Lf(e,t){var n=_f(e,false),r=t?Af:Of;return function(e,t){return r(n(e,t),e,this)}}function Af(e,t){var n;if(gt){n=Ma(t)?4:6;return e[2][1]+n*(t.value<0?-1:1)}else{return e[0][0]+(e[2][0]-e[0][0])/2}}function Of(e,t,n){var r=n.getBoundingClientRect();if(gt){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:Ma(t)?-3:-6)}}function Mf(e,t){var n=e.__max__+1,r=ha(n,e,!!t),i=pa(!!t),s=da(e,!!t),o=t?ns:ts;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&f<u||e.value<0&&f>u){f=u}}return[[a,u],[a,f-(n-u)]]}}function _f(e,t){var n=e.__max__+1,r=la(Jr,n),i=ua(r,n,e,!!t),s=aa(!!t),o=fa(e,!!t),u=t?ns:ts;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(gt){if(0<e.value&&l<n||e.value<0&&n<l){l=n}}return[[f,a],[f,l-(n-a)],[f+r,l-(n-a)],[f+r,a]]}}function Df(e,t){var n=e.__max__+1,r=ma(n,e,!!t),i=ga(!!t),s=ya(e,!!t),o=t?ns:ts;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&f<u||e.value<0&&f>u){f=u}}return[[a,f-(n-u)]]}}function Bf(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m,g;var y,b;var w=[];if(s(r)){for(u=0;u<r.length;u++){w[u]={};if(i(r[u].start)){w[u].start=e[0].x}else{w[u].start=tr?$a(r[u].start):r[u].start}if(i(r[u].end)){w[u].end=e[e.length-1].x}else{w[u].end=tr?$a(r[u].end):r[u].end}}}y=gt?function(e){return n(e.value)}:function(e){return t(e.x)};b=gt?function(e){return t(e.x)}:function(e){return n(e.value)};if(tr){l=function(e,r,i,s){var o=e.x.getTime(),u=r.x-e.x,a=new Date(o+u*i),f=new Date(o+u*(i+s));return"M"+t(a)+" "+n(h(i))+" "+t(f)+" "+n(h(i+s))}}else{l=function(e,r,i,s){return"M"+t(c(i),true)+" "+n(h(i))+" "+t(c(i+s),true)+" "+n(h(i+s))}}for(u=0;u<e.length;u++){if(i(w)||!Qa(e[u].x,w)){f+=" "+y(e[u])+" "+b(e[u])}else{c=Yi(e[u-1].x,e[u].x,tr);h=Yi(e[u-1].value,e[u].value);p=t(e[u].x)-t(e[u-1].x);d=n(e[u].value)-n(e[u-1].value);v=Math.sqrt(Math.pow(p,2)+Math.pow(d,2));m=2/v;g=m*2;for(a=m;a<=1;a+=g){f+=l(e[u-1],e[u],a,m)}}o=e[u].x}return f}function Kf(t){var r,i,s;Xf=u.select(h);if(Xf.empty()){throw new Error("Element to bind not found")}Xf.html("").classed("c3",true);a.data.xs={};a.data.targets=Ao(t);if(W){a.data.targets=a.data.targets.filter(W)}if(z){Wo(z===true?Bo(a.data.targets):z)}yi();Qi();Ur.domain(u.extent(oo(a.data.targets)));zr.domain(no(a.data.targets,"y"));Wr.domain(no(a.data.targets,"y2"));Xr.domain(Ur.domain());Vr.domain(zr.domain());$r.domain(Wr.domain());Vf=Ur.domain();jf.scale(Xr);if(b){Ff.scale(Ur)}If=Xf.append("svg").style("overflow","hidden").on("mouseenter",x).on("mouseleave",T);qf=If.append("defs");qf.append("clipPath").attr("id",Kn).append("rect");qf.append("clipPath").attr("id",Qn).append("rect");qf.append("clipPath").attr("id",Gn).append("rect");ul();Rf=If.append("g").attr("transform",ri.main);Uf=If.append("g").attr("transform",ri.context);zf=If.append("g").attr("transform",ri.legend);if(!ot){Uf.style("visibility","hidden")}if(!ct){zf.style("visibility","hidden");vr=Bo(a.data.targets)}Wf=Xf.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none");wl(Bo(a.data.targets),{withTransform:false,withTransitionForTransform:false});if(a.data.targets.length==0){Rf.append("text").attr("class",n.text).attr("x",Rf[0][0].parentNode.width.baseVal.value/2-mr.left).attr("y",Rf[0][0].parentNode.height.baseVal.value/2-mr.top).attr("text-anchor","middle").attr("style",(st?"fill:"+st+"; ":"")+(it?"font-size:"+it+"; ":"")).text(rt)}i=Rf.append("g").attr("clip-path",Yn).attr("class",n.grid);if(tn){i.append("g").attr("class",n.xgrids)}if(Ya(rn)){i.append("g").attr("class",n.xgridLines)}if(ln){i.append("g").attr("class",n.xgridFocus).append("line").attr("class",n.xgridFocus)}if(sn){i.append("g").attr("class",n.ygrids)}if(Ya(on)){i.append("g").attr("class",n.ygridLines)}Rf.append("g").attr("clip-path",Yn).attr("class",n.regions);Rf.append("g").attr("clip-path",Yn).attr("class",n.chart);r=Rf.select("."+n.chart).append("g").attr("class",n.eventRects).style("fill-opacity",0).style("cursor",b?gt?"ns-resize":"ew-resize":null);Rf.select("."+n.chart).append("g").attr("class",n.chartBars);Rf.select("."+n.chart).append("g").attr("class",n.chartLines);Rf.select("."+n.chart).append("g").attr("class",n.chartArcs).attr("transform",ri.arc).append("text").attr("class",n.chartArcsTitle).style("text-anchor","middle").text(Qs());Rf.select("."+n.chart).append("g").attr("class",n.chartTexts);if(b){Rf.insert("rect",E?null:"g."+n.grid).attr("class",n.zoomRect).attr("width",br).attr("height",Er).style("opacity",0).style("cursor",gt?"ns-resize":"ew-resize").call(Ff).on("dblclick.zoom",null)}if(Pt){jf.extent(typeof Pt!=="function"?Pt:Pt(oo()))}Yr.x=Rf.append("g").attr("class",n.axisX).attr("clip-path",Zn).attr("transform",ri.x).style("visibility",yt?"visible":"hidden");Yr.x.append("text").attr("class",n.axisXLabel).attr("transform",gt?"rotate(-90)":"").style("text-anchor",Ds);Yr.y=Rf.append("g").attr("class",n.axisY).attr("clip-path",er).attr("transform",ri.y).style("visibility",Bt?"visible":"hidden");Yr.y.append("text").attr("class",n.axisYLabel).attr("transform",gt?"":"rotate(-90)").style("text-anchor",Ps);Yr.y2=Rf.append("g").attr("class",n.axisY2).attr("transform",ri.y2).style("visibility",Xt?"visible":"hidden");Yr.y2.append("text").attr("class",n.axisY2Label).attr("transform",gt?"":"rotate(-90)").style("text-anchor",Hs);Uf.append("g").attr("clip-path",Yn).attr("class",n.chart);Uf.select("."+n.chart).append("g").attr("class",n.chartBars);Uf.select("."+n.chart).append("g").attr("class",n.chartLines);Uf.append("g").attr("clip-path",Yn).attr("class",n.brush).call(jf).selectAll("rect").attr(gt?"width":"height",gt?wr:Sr);Yr.subx=Uf.append("g").attr("class",n.axisX).attr("transform",ri.subx).attr("clip-path",gt?"":Zn);ll(a.data.targets);rl({withUpdateTranslate:true,withTransform:true,withUpdateXDomain:true,withUpdateOrgXDomain:true,withTransitionForAxis:false});if(Vn){if(tr&&typeof $n==="string"){$n=$a($n);for(s=0;s<a.data.targets[0].values.length;s++){if(a.data.targets[0].values[s].x-$n===0){break}}$n=s}Wf.html(Xn(a.data.targets.map(function(e){return xo(e.values[$n])}),os(),Pu(Ca(a.data.targets)),lr));Wf.style("top",Jn.top).style("left",Jn.left).style("display","block")}if(e.onresize==null){e.onresize=ol()}if(e.onresize.add){e.onresize.add(N);e.onresize.add(function(){fl({withLegend:true,withTransition:false,withTransitionForTransform:false})});e.onresize.add(C)}}function Qf(e){e.append("rect").attr("class",vu).style("cursor",X&&V?"pointer":null).on("mouseover",function(e,t){if(sr){return}if(Ca(a.data.targets)){return}var r=a.data.targets.map(function(e){return xo(e.values[t])});var i,s;if(Object.keys(_).length>0){s=[];for(var o in _){for(i=0;i<r.length;i++){if(r[i].id===o){s.push(r[i]);r.shift(i);break}}}r=s.concat(r)}if(cn){yf(t)}Ef(t);Rf.selectAll("."+n.shape+"-"+t).each(function(e){Q(e)})}).on("mouseout",function(e,t){if(Ca(a.data.targets)){return}na();ea();bf(t);Sf();Rf.selectAll("."+n.shape+"-"+t).each(function(e){G(e)})}).on("mousemove",function(e,t){var r;if(sr){return}if(Ca(a.data.targets)){return}r=Ro(a.data.targets).map(function(e){return xo(e.values[t])});Zu(r,u.mouse(this));ta(r);if(!X){return}if(V){return}Rf.selectAll("."+n.shape+"-"+t).filter(function(e){return $(e)}).each(function(){var e=u.select(this).classed(n.EXPANDED,true);if(this.nodeName==="circle"){e.attr("r",vf)}If.select("."+n.eventRect+"-"+t).style("cursor",null)}).filter(function(e){if(this.nodeName==="circle"){return Ja(this,mf(e))}else if(this.nodeName==="path"){return Ka(this)}}).each(function(){var e=u.select(this);if(!e.classed(n.EXPANDED)){e.classed(n.EXPANDED,true);if(this.nodeName==="circle"){e.attr("r",mf)}}If.select("."+n.eventRect+"-"+t).style("cursor","pointer")})}).on("click",function(e,t){if(Ca(a.data.targets)){return}if(or){or=false;return}Rf.selectAll("."+n.shape+"-"+t).each(function(e){Yf(this,e,t)})}).call(u.behavior.drag().origin(Object).on("drag",function(){Zf(u.mouse(this))}).on("dragstart",function(){el(u.mouse(this))}).on("dragend",function(){tl()})).call(Ff).on("dblclick.zoom",null)}function Gf(e){e.append("rect").attr("x",0).attr("y",0).attr("width",br).attr("height",Er).attr("class",n.eventRect).on("mouseout",function(){if(Ca(a.data.targets)){return}na();ea();bf()}).on("mousemove",function(){var e=Ro(a.data.targets);var t,r,i,s;if(sr){return}if(Ca(e)){return}t=u.mouse(this);r=Vu(e,t);if(!r){return}if(_a(r)){i=[r]}else{i=Ju(e,r.x)}s=i.map(function(e){return xo(e)});Zu(s,t);if(cn){bf();yf(r.index,r.id)}ta(s);if(ef(r,t)<100){If.select("."+n.eventRect).style("cursor","pointer");if(!ur){Q(r);ur=true}}else{If.select("."+n.eventRect).style("cursor",null);G(r);ur=false}}).on("click",function(){var e=Ro(a.data.targets);var t,r;if(Ca(e)){return}t=u.mouse(this);r=Vu(e,t);if(!r){return}if(ef(r,t)<100){Rf.select("."+n.circles+"-"+xu(r.id)).select("."+n.circle+"-"+r.index).each(function(){Yf(this,r,r.index)})}}).call(u.behavior.drag().origin(Object).on("drag",function(){Zf(u.mouse(this))}).on("dragstart",function(){el(u.mouse(this))}).on("dragend",function(){tl()})).call(Ff).on("dblclick.zoom",null)}function Yf(e,t,r){var i=u.select(e),s=i.classed(n.SELECTED),o,a;if(e.nodeName==="circle"){o=Ja(e,mf(t)*1.5);a=uf}else if(e.nodeName==="path"){if(i.classed(n.bar)){o=Ka(e);a=lf}else{o=true;a=cf}}if(V||o){if(X&&$(t)){if(!J){Rf.selectAll("."+n.shapes+(V?xu(t.id):"")).selectAll("."+n.shape).each(function(e,t){var r=u.select(this);if(r.classed(n.SELECTED)){a(false,r.classed(n.SELECTED,false),e,t)}})}i.classed(n.SELECTED,!s);a(!s,i,t,r)}K(t,e)}}function Zf(e){var t,r,i,s,o,f,l,c;if(Ca(a.data.targets)){return}if(!X){return}if(b&&!Ff.altDomain){return}if(!J){return}t=ir[0];r=ir[1];i=e[0];s=e[1];o=Math.min(t,i);f=Math.max(t,i);l=V?mr.top:Math.min(r,s);c=V?Er:Math.max(r,s);Rf.select("."+n.dragarea).attr("x",o).attr("y",l).attr("width",f-o).attr("height",c-l);Rf.selectAll("."+n.shapes).selectAll("."+n.shape).filter(function(e){return $(e)}).each(function(e,t){var r=u.select(this),i=r.classed(n.SELECTED),s=r.classed(n.INCLUDED),a,h,p,d,v,m=false,g;if(r.classed(n.circle)){a=r.attr("cx")*1;h=r.attr("cy")*1;v=uf;m=o<a&&a<f&&l<h&&h<c}else if(r.classed(n.bar)){g=Ku(this);a=g.x;h=g.y;p=g.width;d=g.height;v=lf;m=!(f<a||a+p<o)&&!(c<h||h+d<l)}else{return}if(m^s){r.classed(n.INCLUDED,!s);r.classed(n.SELECTED,!i);v(!i,r,e,t)}})}function el(e){if(Ca(a.data.targets)){return}if(!X){return}ir=e;Rf.select("."+n.chart).append("rect").attr("class",n.dragarea).style("opacity",.1);sr=true;et()}function tl(){if(Ca(a.data.targets)){return}if(!X){return}Rf.select("."+n.dragarea).transition().duration(100).style("opacity",0).remove();Rf.selectAll("."+n.shape).classed(n.INCLUDED,false);sr=false;tt()}function nl(e,t){if(t==="grid"){e.each(function(){var e=u.select(this),t=e.attr("x1"),n=e.attr("x2"),r=e.attr("y1"),i=e.attr("y2");e.attr({x1:Math.ceil(t),x2:Math.ceil(n),y1:Math.ceil(r),y2:Math.ceil(i)})})}}function rl(e,t){var i,s,o,f,l,c,h,p;var d,v,m,g,y,w,E,x,T,N,C,L,O,M;var _=ca(),D=oa(),P=va(),H,B;var j,F;var I,q,R,U,z,W,X,V,J,K;var Q=Ca(a.data.targets);var G,Y,Z,et,tt,rt;var it,st,ut;var at=Ro(a.data.targets),ht,pt,dt;if(at.length===0&&nt){return}e=e||{};I=nf(e,"withY",true);q=nf(e,"withSubchart",true);R=nf(e,"withTransition",true);W=nf(e,"withTransform",false);X=nf(e,"withUpdateXDomain",false);V=nf(e,"withUpdateOrgXDomain",false);K=nf(e,"withUpdateTranslate",false);J=nf(e,"withLegend",false);U=nf(e,"withTransitionForExit",R);z=nf(e,"withTransitionForAxis",R);it=R?k:0;st=U?it:0;ut=z?it:0;t=t||al(ut);if(K){if(gt){Yr.x.call(Jr);Yr.subx.call(Gr)}else{Yr.y.call(Kr);Yr.y2.call(Qr)}yi();Qi();ul();di(false)}if(J&&ct){wl(Bo(a.data.targets),e,t)}if(nr&&at.length===0){Ur.domain([0,Yr.x.selectAll(".tick").size()])}if(at.length){if(V){Ur.domain(u.extent(oo(at)));Vf=Ur.domain();if(b){Ff.scale(Ur).updateScaleExtent()}Xr.domain(Ur.domain());jf.scale(Xr)}if(X){Ur.domain(jf.empty()?Vf:jf.extent());if(b){Ff.scale(Ur).updateScaleExtent()}}if(!Lt&&(kt||Ct)){ht=zo(Uo(at),Ct);Jr.tickValues(ht);Gr.tickValues(ht)}}zr.domain(no(at,"y"));Wr.domain(no(at,"y2"));Yr.x.style("opacity",Q?0:1);Yr.y.style("opacity",Q?0:1);Yr.y2.style("opacity",Q?0:1);Yr.subx.style("opacity",Q?0:1);t.axisX.call(Jr);t.axisY.call(Kr);t.axisY2.call(Qr);t.axisSubX.call(Gr);js(R);if(X&&at.length){if(Tt&&ht){for(pt=1;pt<ht.length;pt++){if(ht.length/pt<Nt){dt=pt;break}}If.selectAll("."+n.axisX+" .tick text").each(function(e){var t=ht.indexOf(e);if(t>=0){u.select(this).style("display",t%dt?"none":"block")}})}else{If.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){hs(Yr.x,t.axisX,At)}G=Nf(_);Y=Cf(D);et=kf(P);tt=Lf(D,true);rt=Lf(D,false);Vr.domain(zr.domain());$r.domain(Wr.domain());Wf.style("display","none");bi();Rf.select("line."+n.xgridFocus).style("visibility","hidden");if(tn){o=ra(nn,Ur);B=nr?Jr.tickOffset():0;s=gt?{x1:0,x2:br,y1:function(e){return Ur(e)-B},y2:function(e){return Ur(e)-B}}:{x1:function(e){return Ur(e)+B},x2:function(e){return Ur(e)+B},y1:mr.top,y2:Er};i=Rf.select("."+n.xgrids).selectAll("."+n.xgrid).data(o);i.enter().append("line").attr("class",n.xgrid);i.attr(s).style("opacity",function(){return+u.select(this).attr(gt?"y1":"x1")===(gt?Er:0)?0:1});i.exit().remove()}if(Ya(rn)){f=Rf.select("."+n.xgridLines).selectAll("."+n.xgridLine).data(rn);l=f.enter().append("g").attr("class",function(e){return n.xgridLine+(e.class?e.class:"")});l.append("line").style("opacity",0);l.append("text").attr("text-anchor","end").attr("transform",gt?"":"rotate(-90)").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);f.select("line").transition().duration(it).attr("x1",gt?0:Ru).attr("x2",gt?br:Ru).attr("y1",gt?Ru:mr.top).attr("y2",gt?Ru:Er).style("opacity",1);f.select("text").transition().duration(it).attr("x",gt?br:0).attr("y",Ru).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(it).style("opacity",0).remove()}if(I&&sn){c=Rf.select("."+n.ygrids).selectAll("."+n.ygrid).data(zr.ticks(un));c.enter().append("line").attr("class",n.ygrid);c.attr("x1",gt?zr:0).attr("x2",gt?zr:br).attr("y1",gt?0:zr).attr("y2",gt?Er:zr);c.exit().remove();nl(c,"grid")}if(I&&Ya(on)){h=Rf.select("."+n.ygridLines).selectAll("."+n.ygridLine).data(on);p=h.enter().append("g").attr("class",function(e){return n.ygridLine+(e.class?e.class:"")});p.append("line").style("opacity",0);p.append("text").attr("text-anchor","end").attr("transform",gt?"rotate(-90)":"").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);h.select("line").transition().duration(it).attr("x1",gt?Uu:0).attr("x2",gt?Uu:br).attr("y1",gt?0:Uu).attr("y2",gt?Er:Uu).style("opacity",1);h.select("text").transition().duration(it).attr("x",gt?0:br).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(it).style("opacity",0).remove()}E=Rf.select("."+n.regions).selectAll("."+n.region).data(Rn);E.enter().append("g").attr("class",du).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(it).attr("x",co).attr("y",ho).attr("width",po).attr("height",vo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(it).style("opacity",0).remove();y=Rf.selectAll("."+n.bars).selectAll("."+n.bar).data(qa);y.enter().append("path").attr("class",au).style("stroke",function(e){return lr(e.id)}).style("stroke-width",2).style("opacity",0).style("fill",function(e){return lr(e.id)}).style("fill-opacity",function(){if(ft){return ft}return Lu});y.style("opacity",Lu).transition().duration(it).attr("d",Y).style("fill",lr).style("opacity",1);y.exit().transition().duration(st).style("opacity",0).remove();d=Rf.selectAll("."+n.lines).selectAll("."+n.line).data(ja);d.enter().append("path").attr("class",iu).style("stroke",lr);d.style("opacity",Lu).transition().duration(it).attr("d",et).style("stroke",lr).style("opacity",1);d.exit().transition().duration(st).style("opacity",0).remove();v=Rf.selectAll("."+n.steps).selectAll("."+n.step).data(Fa);v.enter().append("path").attr("class",mu).style("stroke",lr);v.style("opacity",Lu).transition().duration(it).attr("d",et).style("stroke",lr).style("opacity",1);v.exit().transition().duration(st).style("opacity",0).remove();m=Rf.selectAll("."+n.areas).selectAll("."+n.area).data(Ua);m.enter().append("path").attr("class",hu).style("fill",lr).style("opacity",function(){$f=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(it).attr("d",G).style("fill",lr).style("opacity",$f);m.exit().transition().duration(st).style("opacity",0).remove();g=Rf.selectAll("."+n.circles).selectAll("."+n.circle).data(Ra);g.enter().append("circle").attr("class",ou).attr("r",df).style("fill",lr);g.style("opacity",Lu).transition().duration(it).style("opacity",Ou).style("fill",lr).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa);g.exit().remove();x=Rf.selectAll("."+n.texts).selectAll("."+n.text).data(za);x.enter().append("text").attr("class",eu).attr("text-anchor",function(e){return gt?e.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",lr).style("fill-opacity",0);x.text(function(e){return Iu(e.id)(e.value,e.id)}).style("fill-opacity",Au).transition().duration(it).attr("x",tt).attr("y",rt).style("fill",lr).style("fill-opacity",Mu);x.exit().transition().duration(st).style("fill-opacity",0).remove();w=Rf.selectAll("."+n.arcs).selectAll("."+n.arc).data(Ia);if(Mn==="arc"){w.enter().append("path").attr("class","").style("opacity",1).style("fill",xn).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(e){e.value=Cn;e.startAngle=-1*(Math.PI/2);e.endAngle=Math.PI/2;return Rs(e,true)});w.exit().transition().duration(st).style("opacity",0).remove()}w.enter().append("path").attr("class",lu).style("fill",function(e){return lr(e.data)}).style("cursor",function(e){return $(e)?"pointer":null}).style("opacity",0).each(function(e){this._current=e}).on("mouseover",function(e,t){var n,r,i;if(ar){return}n=Fs(e);r=Ws(n);i=Ys();Vs(n.data.id);ml(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Fs(e),n=Ws(t),r=[n];Zu(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ar){return}n=Fs(e);r=Ws(n);i=Zs();$s(n.data.id);gl();ea();i(r,t)}).on("click",function(e,t){var n=Fs(e),r=Ws(n),i=Gs();Yf(this,e,t);i(r,t)});w.attr("transform",W?"scale(0)":"").style("opacity",function(e){return e===this._current?0:1}).each(function(){ar=true}).transition().duration(it).attrTween("d",function(e){var t=Fs(e),n;if(!t){return function(){return"M 0 0"}}if(isNaN(this._current.endAngle))this._current.endAngle=this._current.startAngle;n=u.interpolate(this._current,t);this._current=n(0);return function(e){return Rs(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return Mn==="arc"&&lt?cr(e.data.values[0].value):lr(e.data.id)}).style("opacity",ft?ft:1).call(tf,function(){ar=false});w.exit().transition().duration(st).style("opacity",0).remove();Rf.selectAll("."+n.chartArc).select("text").attr("transform",Us).style("opacity",0).transition().duration(it).text(Xs).style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});if(Mn==="arc"){Rf.selectAll("."+n.chartArc).select("text.units").attr("transform",Us).style("opacity",0).transition().duration(it).text(Tn?_n:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});Rf.selectAll("."+n.chartArc).select("text.min").attr("transform",Us).style("opacity",0).transition().duration(it).text(Tn?kn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});Rf.selectAll("."+n.chartArc).select("text.max").attr("transform",Us).style("opacity",0).transition().duration(it).text(Tn?Cn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0})}Rf.select("."+n.chartArcsTitle).style("opacity",Na(a.data.targets)||Ta(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){jf.extent(Ur.orgDomain()).update()}if(q){if(!gt&&At){hs(Yr.subx,t.axisSubX,At)}if(!jf.empty()){jf.extent(Ur.orgDomain()).update()}Z=Cf(D,true);L=Uf.selectAll("."+n.bars).selectAll("."+n.bar).data(qa);L.enter().append("path").attr("class",au).style("stroke","none").style("fill",lr);L.style("opacity",Lu).transition().duration(it).attr("d",Z).style("opacity",1);L.exit().transition().duration(it).style("opacity",0).remove();T=Uf.selectAll("."+n.lines).selectAll("."+n.line).data(ja);T.enter().append("path").attr("class",iu).style("stroke",lr);T.style("opacity",Lu).transition().duration(it).attr("d",Pf).style("opacity",1);T.exit().transition().duration(it).style("opacity",0).remove();N=Uf.selectAll("."+n.steps).selectAll("."+n.step).data(Fa);N.enter().append("path").attr("class",iu).style("stroke",lr);N.style("opacity",Lu).transition().duration(it).attr("d",Pf).style("opacity",1);N.exit().transition().duration(it).style("opacity",0).remove();C=Uf.selectAll("."+n.areas).selectAll("."+n.area).data(La?Fa:ja);C.enter().append("path").attr("class",hu).style("fill",lr).style("opacity",function(){$f=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(it).attr("d",Hf).style("fill",lr).style("opacity",$f);C.exit().transition().duration(st).style("opacity",0).remove()}}Rf.selectAll("."+n.selectedCircles).filter(function(e){return Ma(e)}).selectAll("circle").remove();Rf.selectAll("."+n.selectedCircle).transition().duration(it).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa);if(S){O=Rf.select("."+n.eventRects);if(Ya(A)&&!So(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=Rf.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Gf(M.enter());M.attr("x",0).attr("y",0).attr("width",br).attr("height",Er)}else{if(!O.classed(n.eventRectsSingle)){O.classed(n.eventRectsMultiple,false).classed(n.eventRectsSingle,true).selectAll("."+n.eventRect).remove()}if(rr&&!nr){F=function(e,t){var n=Mo(t),r=_o(t),i=a.data.xs[e.id][t];return(Ur(r?r:i+50)-Ur(n?n:i-50))/2};j=function(e,t){var n=Mo(t),r=a.data.xs[e.id][t];return(Ur(r)+Ur(n?n:r-50))/2}}else{F=Wi();j=function(e){return Ur(e.x)-F/2}}H=Po(a.data.targets);Rf.select("."+n.eventRects).datum(H?H.values:[]);M=Rf.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Qf(M.enter());M.attr("class",vu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?br:F).attr("height",gt?F:Er);M.exit().remove()}}Bo(a.data.targets).forEach(function(e){Jf[e]=true})}function il(){rl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function sl(){if(Ro(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Ff.altDomain){Ur.domain(Ff.altDomain);Ff.scale(Ur).updateScaleExtent();return}if(nr&&Ur.orgDomain()[0]===Vf[0]){Ur.domain([Vf[0]-1e-10,Ur.orgDomain()[1]])}rl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){or=true}}function ol(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function ul(){If.attr("width",xr).attr("height",Tr);If.select("#"+Kn).select("rect").attr("width",br).attr("height",Er);If.select("#"+Qn).select("rect").attr("x",Pi).attr("y",Hi).attr("width",qi).attr("height",Ri);If.select("#"+Gn).select("rect").attr("x",Bi).attr("y",ji).attr("width",Ui).attr("height",zi);If.select("."+n.zoomRect).attr("width",br).attr("height",Er);Xf.style("max-height",Tr+"px")}function al(e){return{axisX:e?Yr.x.transition().duration(e):Yr.x,axisY:e?Yr.y.transition().duration(e):Yr.y,axisY2:e?Yr.y2.transition().duration(e):Yr.y2,axisSubX:e?Yr.subx.transition().duration(e):Yr.subx}}function fl(e){var t;e=e||{};e.withTransition=nf(e,"withTransition",true);e.withTransform=nf(e,"withTransform",false);e.withLegend=nf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=al(e.withTransitionForAxis?k:0);yi();Qi();ul();di(e.withTransition,t)}rl(e,t)}function ll(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=Rf.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",bu);f=a.enter().append("g").attr("class",bu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",tu);s=Rf.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Eu);i=s.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",fu).style("cursor",function(e){return $(e)?"pointer":null});r=Rf.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",wu);t=r.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",su);t.append("g").attr("class",gu);t.append("g").attr("class",pu);t.append("g").attr("class",function(e){return Zo(n.selectedCircles,e.id)});t.append("g").attr("class",uu).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){Rf.selectAll("."+n.selectedCircles+xu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=Rf.select("."+n.chartArcs).selectAll("."+n.chartArc).data(Dr(e)).attr("class",Su);o=u.enter().append("g").attr("class",Su);o.append("g").attr("class",cu);o.append("text").attr("dy",Mn==="arc"?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",br/10+"px");if(Mn==="arc"){o.select("text").style("fill","#000");o.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",br/15+"px");o.append("text").attr("dx",-1*(kr+(Nr-kr)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px");o.append("text").attr("dx",kr+(Nr-kr)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px")}if(ot){p=Uf.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Eu);h=p.enter().append("g").style("opacity",0).attr("class",Eu);h.append("g").attr("class",fu);c=Uf.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",wu);l=c.enter().append("g").style("opacity",0).attr("class",wu);l.append("g").attr("class",su);l.append("g").attr("class",gu);l.append("g").attr("class",pu)}If.selectAll("."+n.target).filter(function(e){return Io(e.id)}).transition().duration(k).style("opacity",1)}function cl(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?ba(e.id,t.types[e.id]):ba(e.id,t.type)})}a.data.targets.forEach(function(t){for(var n=0;n<e.length;n++){if(t.id===e[n].id){t.values=e[n].values;e.splice(n,1);break}}});a.data.targets=a.data.targets.concat(e);ll(a.data.targets);rl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t.done==="function"){t.done()}}function hl(e){if("data"in e){cl(Ao(e.data),e)}else if("url"in e){u.csv(e.url,function(t,n){cl(Ao(n),e)})}else if("rows"in e){cl(Ao(ko(e.rows)),e)}else if("columns"in e){cl(Ao(Lo(e.columns)),e)}else{throw Error("url or rows or columns is required.")}}function pl(e,t){if(typeof t!=="function"){t=function(){}}e=e.filter(function(e){return Fo(a.data.targets,e)});if(!e||e.length===0){t();return}If.selectAll(e.map(function(e){return Tu(e)})).transition().style("opacity",0).remove().call(tf,t);e.forEach(function(e){Jf[e]=false;zf.selectAll("."+n.legendItem+xu(e)).remove();a.data.targets=a.data.targets.filter(function(t){return t.id!==e})})}function dl(e){return e.classed(n.legendItemHidden)?ai:1}function vl(e){return e.classed(n.legendItemHidden)?ai:.3}function ml(e,t){zf.selectAll("."+n.legendItem).transition().duration(100).style("opacity",function(n){var r=u.select(this);if(e&&n!==e){return t?vl(r):dl(r)}else{return t?dl(r):vl(r)}})}function gl(){zf.selectAll("."+n.legendItem).transition().duration(100).style("opacity",function(){return dl(u.select(this))})}function yl(e){if(!ct){ct=true;zf.style("visibility","visible")}$o(e);zf.selectAll(ku(e)).style("visibility","visible").transition().style("opacity",function(){return dl(u.select(this))})}function bl(e){if(ct&&Ga(e)){ct=false;zf.style("visibility","hidden")}Vo(e);zf.selectAll(ku(e)).style("opacity",0).style("visibility","hidden")}function wl(e,t,r){function D(t,n,r){function c(e,t){if(!t){f=(a-b-u)/2;if(f<g){f=(a-u)/2;b=0;N++}}T[e]=N;x[N]=f;w[e]=b;b+=u}var i=t.getBoundingClientRect(),s=Math.ceil((i.width+d)/10)*10,o=Math.ceil((i.height+p)/10)*10,u=ii?o:s,a=ii?Ki():Ji(),f,l;if(r){b=0;N=0;v=0;m=0}if(ct&&!qo(n)){E[n]=S[n]=T[n]=w[n]=0;return}E[n]=s;S[n]=o;if(!v||s>=v){v=s}if(!m||o>=m){m=o}l=ii?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});f=(a-l*e.length)/2;if(f<g){b=0;N=0;e.forEach(function(e){c(e)})}else{c(n,true)}}else{c(n)}}var i,o,f,l,c,h;var p=4,d=26,v=0,m=0,g=10;var y,b=0,w={},E={},S={},x=[0],T={},N=0;var C,k;var L=zf.selectAll("."+n.legendItemFocused).size();var A,O,M;t=t||{};C=nf(t,"withTransition",true);k=nf(t,"withTransitionForTransform",true);if(ii){i=function(e){return v*T[e]};l=function(e){return x[T[e]]+w[e]}}else{i=function(e){return x[T[e]]+w[e]};l=function(e){return m*T[e]}}o=function(e,t){return i(e,t)+14};c=function(e,t){return l(e,t)+9};f=function(e,t){return i(e,t)-4};h=function(e,t){return l(e,t)-7};y=zf.selectAll("."+n.legendItem).data(e).enter().append("g").attr("class",function(e){return Zo(n.legendItem,e)}).style("visibility",function(e){return qo(e)?"visible":"hidden"}).style("cursor","pointer").on("click",function(e){typeof pt==="function"?pt(e):a.toggle(e)}).on("mouseover",function(e){u.select(this).classed(n.legendItemFocused,true);if(!ar){a.focus(e)}if(typeof dt==="function"){dt(e)}}).on("mouseout",function(e){u.select(this).classed(n.legendItemFocused,false);if(!ar){a.revert()}if(typeof vt==="function"){vt(e)}});y.append("text").text(function(e){return s(_[e])?_[e]:e}).each(function(e,t){D(this,e,t===0)}).style("pointer-events","none").attr("x",ii?o:-200).attr("y",ii?-200:c);y.append("rect").attr("class",n.legendItemEvent).style("fill-opacity",0).attr("x",ii?f:-200).attr("y",ii?-200:h);y.append("rect").attr("class",n.legendItemTile).style("pointer-events","none").style("fill",lr).attr("x",ii?o:-200).attr("y",ii?-200:l).attr("width",10).attr("height",10);A=zf.selectAll("text").data(e).text(function(e){return s(_[e])?_[e]:e}).each(function(e,t){D(this,e,t===0)});(C?A.transition():A).attr("x",o).attr("y",c);O=zf.selectAll("rect."+n.legendItemEvent).data(e);(C?O.transition():O).attr("width",function(e){return E[e]}).attr("height",function(e){return S[e]}).attr("x",f).attr("y",h);M=zf.selectAll("rect."+n.legendItemTile).data(e);(C?M.transition():M).style("fill",lr).attr("x",i).attr("y",l);zf.selectAll("."+n.legendItem).classed(n.legendItemHidden,function(e){return!Io(e)}).transition().style("opacity",function(e){var t=u.select(this);if(Io(e)){return!L||t.classed(n.legendItemFocused)?dl(t):vl(t)}else{return ai}});Vi(v);$i(m);Xi(N);yi();Qi();ul();di(k,r)}function El(e){return Fo(a.data.targets,e.id)}function Sl(e){return"data"in e&&Fo(a.data.targets,e.data.id)}function xl(e){var t=e&&e.value?e.value:null,n=e&&e["class"]?e["class"]:null;return t?function(e){return e.value!==t}:n?function(e){return e["class"]!==n}:function(){return true}}function Tl(e,t,n){var r=!Ca(a.data.targets);ar=false;ba(e,t);fl(n||{withTransitionForAxis:r})}var u=e.d3?e.d3:"undefined"!==typeof require?require("d3"):undefined;var a={data:{},axis:{},legend:{}},f={};var h=c(["bindto"],"#chart");var p=c(["size","width"]),d=c(["size","height"]);var v=c(["padding","left"]),m=c(["padding","right"]),g=c(["padding","top"]),y=c(["padding","bottom"]);var b=c(["zoom","enabled"],false),w=c(["zoom","extent"]),E=c(["zoom","privileged"],false);var S=c(["interaction","enabled"],true);var x=c(["onenter"],function(){}),T=c(["onleave"],function(){}),N=c(["onresize"],function(){}),C=c(["onresized"],function(){});var k=c(["transition","duration"],350);l("data","data is required in config");var L=c(["data","x"]),A=c(["data","xs"],{}),O=c(["data","x_format"]),M=c(["data","id_converter"],function(e){return e}),_=c(["data","names"],{}),D=c(["data","classes"],{}),P=c(["data","groups"],[]),H=c(["data","axes"],{}),B=c(["data","type"]),j=c(["data","types"],{}),F=c(["data","labels"],{}),I=c(["data","order"]),q=c(["data","regions"],{}),R=c(["data","color"]),U=c(["data","colors"],{}),z=c(["data","hide"],false),W=c(["data","filter"]),X=c(["data","selection","enabled"],false),V=c(["data","selection","grouped"],false),$=c(["data","selection","isselectable"],function(){return true}),J=c(["data","selection","multiple"],true),K=c(["data","onclick"],function(){}),Q=c(["data","onenter"],function(){}),G=c(["data","onleave"],function(){}),Y=c(["data","onselected"],function(){}),Z=c(["data","onunselected"],function(){}),et=c(["data","ondragstart"],function(){}),tt=c(["data","ondragend"],function(){});var nt=c(["data","empty","abort"],true),rt=c(["data","empty","label","text"],""),it=c(["data","empty","label","size"],false),st=c(["data","empty","label","fill"],false);var ot=c(["subchart","show"],false),ut=c(["subchart","size","height"],60);var at=c(["color","pattern"],[]),ft=c(["color","opacity"],null),lt=c(["color","values"],[]);var ct=c(["legend","show"],true),ht=c(["legend","position"],"bottom"),pt=c(["legend","item","onclick"]),dt=c(["legend","item","onmouseover"]),vt=c(["legend","item","onmouseout"]),mt=c(["legend","equally"],false);var gt=c(["axis","rotated"],false),yt=c(["axis","x","show"],true),bt=c(["axis","x","type"],"indexed"),wt=c(["axis","x","localtime"],true),Et=c(["axis","x","categories"],[]),St=c(["axis","x","tick","centered"],false),xt=c(["axis","x","tick","format"]),Tt=c(["axis","x","tick","culling"],{}),Nt=c(["axis","x","tick","culling","max"],10),Ct=c(["axis","x","tick","count"]),kt=c(["axis","x","tick","fit"],true),Lt=c(["axis","x","tick","values"],null),At=c(["axis","x","tick","rotate"]),Ot=c(["axis","x","max"],null),Mt=c(["axis","x","min"],null),_t=c(["axis","x","padding"],{}),Dt=c(["axis","x","height"]),Pt=c(["axis","x","default"]),Ht=c(["axis","x","label"],{}),Bt=c(["axis","y","show"],true),jt=c(["axis","y","max"]),Ft=c(["axis","y","min"]),It=c(["axis","y","center"]),qt=c(["axis","y","label"],{}),Rt=c(["axis","y","inner"],false),Ut=c(["axis","y","tick","format"]),zt=c(["axis","y","padding"]),Wt=c(["axis","y","ticks"],10),Xt=c(["axis","y2","show"],false),Vt=c(["axis","y2","max"]),$t=c(["axis","y2","min"]),Jt=c(["axis","y2","center"]),Kt=c(["axis","y2","label"],{}),Qt=c(["axis","y2","inner"],false),Gt=c(["axis","y2","tick","format"]),Yt=c(["axis","y2","padding"]),Zt=c(["axis","y2","ticks"],10);var en=c(["zeropadding"],false);var tn=c(["grid","x","show"],false),nn=c(["grid","x","type"],"tick"),rn=c(["grid","x","lines"],[]),sn=c(["grid","y","show"],false),on=c(["grid","y","lines"],[]),un=c(["grid","y","ticks"],10);var an=c(["point","show"],true),fn=c(["point","r"],2.5),ln=c(["point","focus","line","enabled"],true),cn=c(["point","focus","expand","enabled"],true),hn=c(["point","focus","expand","r"]),pn=c(["point","focus","select","r"]);var dn=c(["line","connect_null"],false);var vn=c(["bar","width"]),mn=c(["bar","width","ratio"],.6);var gn=c(["pie","label","show"],true),yn=c(["pie","label","format"]),bn=c(["pie","expand"],true),wn=c(["pie","onclick"],function(){}),En=c(["pie","onmouseover"],function(){}),Sn=c(["pie","onmouseout"],function(){});var xn=c(["gauge","color"],"#e0e0e0"),Tn=c(["gauge","label","show"],true),Nn=c(["gauge","label","format"]),Cn=c(["gauge","max"]),kn=c(["gauge","min"]),Ln=c(["gauge","onclick"],function(){}),An=c(["gauge","onmouseover"],function(){}),On=c(["gauge","onmouseout"],function(){}),Mn=c(["gauge","style"]),_n=c(["gauge","units"]),Dn=c(["gauge","width"],false);var Pn=c(["donut","label","show"],true),Hn=c(["donut","label","format"]),Bn=c(["donut","expand"],true),jn=c(["donut","title"],""),Fn=c(["donut","onclick"],function(){}),In=c(["donut","onmouseover"],function(){}),qn=c(["donut","onmouseout"],function(){});var Rn=c(["regions"],[]);var Un=c(["tooltip","show"],true),zn=c(["tooltip","format","title"]),Wn=c(["tooltip","format","value"]),Xn=c(["tooltip","contents"],function(e,t,r,i){var s=zn?zn:t,o=Wn?Wn:r,u,a,f,l,c,h;for(a=0;a<e.length;a++){if(!(e[a]&&(e[a].value||e[a].value===0))){continue}if(!u){f=s?s(e[a].x):e[a].x;u="<table class='"+n.tooltip+"'>"+(f||f===0?"<tr><th colspan='2'>"+f+"</th></tr>":"")}c=e[a].name;l=o(e[a].value,e[a].ratio,e[a].id,e[a].index);h=Mn==="arc"&&lt?cr(e[a].value):i(e[a].id);u+="<tr class='"+n.tooltipName+"-"+e[a].id+"'>";u+="<td class='name'><span style='background-color:"+h+"'></span>"+c+"</td>";u+="<td class='value'>"+l+"</td>";u+="</tr>"}return u+"</table>"}),Vn=c(["tooltip","init","show"],false),$n=c(["tooltip","init","x"],0),Jn=c(["tooltip","init","position"],{top:"0px",left:"50px"});var Kn=(typeof h==="string"?h.replace(/[# .>~+]/g,""):n.chart+ +(new Date))+"-clip",Qn=Kn+"-xaxis",Gn=Kn+"-yaxis",Yn=fi(Kn),Zn=fi(Qn),er=fi(Gn);var tr=bt==="timeseries",nr=bt==="categorized",rr=!tr&&(L||Ya(A));var ir=null,sr=false,or=false,ur=false,ar=false;var fr=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],lr=Xa(U,Ya(at)?at:fr,R),cr=Va(at,lt);var hr=wt?u.time.format:u.time.format.utc,pr=hr.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&e.getDate()!==1}],["%-m/%-d",function(e){return e.getDate()!==1}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return true}]]);var dr=[],vr=[];var mr,gr,yr,br,wr,Er,Sr,xr,Tr;var Nr,Cr,kr,Lr,Ar,Or,Mr,_r,Dr;var Pr,Hr,Br,jr,Fr,Ir,qr,Rr;var Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr,Gr;var Yr={};var Zr=gt?"left":"bottom",ei=gt?Rt?"top":"bottom":Rt?"right":"left",ti=gt?Qt?"bottom":"top":Qt?"left":"right",ni=gt?"left":"bottom";var ri={main:function(){return"translate("+li(mr.left)+","+li(mr.top)+")"},context:function(){return"translate("+li(gr.left)+","+li(gr.top)+")"},legend:function(){return"translate("+yr.left+","+yr.top+")"},x:function(){return"translate(0,"+(gt?0:Er)+")"},y:function(){return"translate(0,"+(gt?Er:0)+")"},y2:function(){return"translate("+(gt?0:br)+","+(gt?1:0)+")"},subx:function(){return"translate(0,"+(gt?0:Sr)+")"},arc:function(){return"translate("+Lr/2+","+Ar/2+")"}};var ii=ht==="right";var si=0,oi=0,ui=0,ai=.15;var vi=30,mi=gt&&!yt?0:30,gi=5;Dr=u.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var xf=function(){var e=u.svg.line().x(gt?function(e){return ts(e.id)(e.value)}:qu).y(gt?qu:function(e){return ts(e.id)(e.value)});if(!dn){e=e.defined(function(e){return e.value!=null})}return function(t){var n=dn?pf(t.values):t.values,r,i;if(ka(t)){Aa(t)?e.interpolate("cardinal"):e.interpolate("linear");return q[t.id]?Bf(n,Ur,ts(t.id),q[t.id]):e(n)}else if(La(t)){e.interpolate("step-after");return q[t.id]?Bf(n,Ur,ts(t.id),q[t.id]):e(n)}else{r=n[0]?Ur(n[0].x):0;i=n[0]?ts(t.id)(n[0].value):0;return gt?"M "+i+" "+r:"M "+r+" "+i}}}();var Tf=function(){var e;if(gt){e=u.svg.area().x0(function(e){return ts(e.id)(0)}).x1(function(e){return ts(e.id)(e.value)}).y(qu)}else{e=u.svg.area().x(qu).y0(function(e){return ts(e.id)(0)}).y1(function(e){return ts(e.id)(e.value)})}return function(t){var n=pf(t.values),r,i;if(wa([t],"area")||wa([t],"area-spline")){Aa(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(wa([t],"area-step")){La(t)?e.interpolate("step-after"):e.interpolate("linear");return e(n)}else{r=n[0]?Ur(n[0].x):0;i=n[0]?ts(t.id)(n[0].value):0;return gt?"M "+i+" "+r:"M "+r+" "+i}}}();var Pf=function(){var e=u.svg.line().x(gt?function(e){return ns(e.id)(e.value)}:zu).y(gt?zu:function(e){return ns(e.id)(e.value)});return function(t){var n=pf(t.values);if(ka(t)){return e(n)}else if(La(t)){e.interpolate("step-after");return e(n)}else{return"M "+Xr(n[0].x)+" "+ns(t.id)(n[0].value)}}}();var Hf=function(){var e=u.svg.area().x(qu).y0(function(e){return ns(e.id)(Ft?Ft:0)}).y1(function(e){return ns(e.id)(e.value)});return function(t){var n=pf(t.values),r,i;if(wa([t],"area")||wa([t],"area-spline")){Aa(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(wa([t],"area-step")){La(t)?e.interpolate("step-after"):e.interpolate("linear");return e(n)}else{r=Xr(n[0].x);i=ns(t.id)(n[0].value);return gt?"M "+i+" "+r:"M "+r+" "+i}}}();var jf,Ff=function(){};jf=u.svg.brush().on("brush",il);jf.update=function(){if(Uf){Uf.select("."+n.brush).call(this)}return this};jf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Ff=u.behavior.zoom().on("zoomstart",function(){Ff.altDomain=u.event.sourceEvent.altKey?Ur.orgDomain():null}).on("zoom",b?sl:null);Ff.scale=function(e){return gt?this.y(e):this.x(e)};Ff.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Do()/e[1],e[1])]};Ff.updateScaleExtent=function(){var e=uo(Ur.orgDomain())/uo(Vf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var If,qf,Rf,Uf,zf,Wf,Xf;var Vf;var $f,Jf={};a.focus=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",1)}var t=If.selectAll(Tu(e)),r=t.filter(El),i=t.filter(Sl);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(Ca(a.data.targets)){Vs(e,true)}ml(e,true)};a.defocus=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",.3)}var t=If.selectAll(Tu(e)),r=t.filter(El),i=t.filter(Sl);a.revert();s(r.classed(n.focused,false));s(i);if(Ca(a.data.targets)){$s(e)}ml(e,false)};a.revert=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",1)}var t=If.selectAll(Tu(e)),r=t.filter(El),i=t.filter(Sl);s(r.classed(n.focused,false));s(i);if(Ca(a.data.targets)){$s(e)}gl()};a.show=function(e,t){e=jo(e);t=t||{};Xo(e);If.selectAll(Nu(e)).transition().style("opacity",1);if(t.withLegend){yl(e)}rl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=jo(e);t=t||{};Wo(e);If.selectAll(Nu(e)).transition().style("opacity",0);if(t.withLegend){bl(e)}rl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){Io(e)?a.hide(e):a.show(e)};a.unzoom=function(){jf.clear().update();rl({withUpdateXDomain:true})};a.load=function(e){if(e.xs){Eo(e.xs)}if("classes"in e){Object.keys(e.classes).forEach(function(t){D[t]=e.classes[t]})}if("categories"in e&&nr){Et=e.categories;Jr.categories(Et)}if("cacheIds"in e&&ao(e.cacheIds)){cl(lo(e.cacheIds),e.done);return}if("unload"in e){pl(jo(typeof e.unload==="boolean"&&e.unload?null:e.unload),function(){hl(e)})}else{hl(e)}};a.unload=function(e,t){pl(jo(e),function(){rl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t==="function"){t()}})};a.selected=function(e){return u.merge(Rf.selectAll("."+n.shapes+xu(e)).selectAll("."+n.shape).filter(function(){return u.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){var t=e.__data__;return t.data?t.data:t})}))};a.select=function(e,t,r){if(!X){return}Rf.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,o){var a=u.select(this),f=i.data?i.data.id:i.id,l=hf(this),c=V||!e||e.indexOf(f)>=0,h=!t||t.indexOf(o)>=0,p=a.classed(n.SELECTED);if(a.classed(n.line)||a.classed(n.area)){return}if(c&&h){if($(i)&&!p){l(true,a.classed(n.SELECTED,true),i,o)}}else if(s(r)&&r){if(p){l(false,a.classed(n.SELECTED,false),i,o)}}})};a.unselect=function(e,t){if(!X){return}Rf.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=hf(this),f=V||!e||e.indexOf(o)>=0,l=!t||t.indexOf(i)>=0,c=s.classed(n.SELECTED);if(s.classed(n.line)||s.classed(n.area)){return}if(f&&l){if($(r)){if(c){a(false,s.classed(n.SELECTED,false),r,i)}}}})};a.toLine=function(e){Tl(e,"line")};a.toSpline=function(e){Tl(e,"spline")};a.toBar=function(e){Tl(e,"bar")};a.toScatter=function(e){Tl(e,"scatter")};a.toArea=function(e){Tl(e,"area")};a.toAreaSpline=function(e){Tl(e,"area-spline")};a.toPie=function(e){Tl(e,"pie",{withTransform:true})};a.toDonut=function(e){Tl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;rl();return P};a.xgrids=function(e){if(!e){return rn}rn=e;rl();return rn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(rn.concat(e))};a.xgrids.remove=function(e){var t=xl(e);return a.xgrids(rn.filter(t))};a.ygrids=function(e){if(!e){return on}on=e;rl();return on};a.ygrids.add=function(e){if(!e){return}return a.ygrids(on.concat(e))};a.ygrids.remove=function(e){var t=xl(e);return a.ygrids(on.filter(t))};a.regions=function(e){if(!e){return Rn}Rn=e;rl();return Rn};a.regions.add=function(e){if(!e){return Rn}Rn=Rn.concat(e);rl();return Rn};a.regions.remove=function(e){var t,r,i;e=e||{};t=nf(e,"duration",k);r=nf(e,"classes",[n.region]);i=Rf.select("."+n.regions).selectAll(r.map(function(e){return"."+e}));(t?i.transition().duration(t):i).style("opacity",0).remove();Rn=Rn.filter(function(e){var t=false;if(!e.class){return true}e.class.split(" ").forEach(function(e){if(r.indexOf(e)>=0){t=true}});return!t});return Rn};a.data.get=function(e){var t=a.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};a.data.getAsTarget=function(e){var t=a.data.targets.filter(function(t){return t.id===e});return t.length>0?t[0]:undefined};a.data.names=function(e){if(!arguments.length){return _}Object.keys(e).forEach(function(t){_[t]=e[t]});rl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});rl({withLegend:true});return U};a.x=function(e){if(arguments.length){To(a.data.targets,e);rl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){No(a.data.targets,e);rl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){fs(t,e[t])});js()}};a.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Ot=+e.x}if(r(e.y)){jt=+e.y}if(r(e.y2)){Vt=+e.y2}}else{jt=Vt=+e}rl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Mt=+e.x}if(r(e.y)){Ft=+e.y}if(r(e.y2)){$t=+e.y2}}else{Ft=$t=+e}rl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){a.axis.max(e.max)}if(typeof e.min!=="undefined"){a.axis.min(e.min)}}};a.legend.show=function(e){yl(jo(e));rl({withLegend:true})};a.legend.hide=function(e){bl(jo(e));rl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;fl({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};Xf.html("");e.onresize=null};if("url"in t.data){u.xhr(t.data.url,function(e,t){var n=u.csv.parseRows(t.response),r;if(n.length===1){r=[{}];n[0].forEach(function(e){r[0][e]=null})}else{r=u.csv.parse(t.response)}Kf(r)})}else if("rows"in t.data){Kf(ko(t.data.rows))}else if("columns"in t.data){Kf(Lo(t.data.columns))}else{throw Error("url or rows or columns is required.")}return a};if(typeof define==="function"&&define.amd){define("c3",["d3"],t)}else if("undefined"!==typeof exports&&"undefined"!==typeof module){module.exports=t}else{e.c3=t}})(window)