mirror of https://github.com/masayuki0812/c3.git
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.
1 lines
81 KiB
1 lines
81 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.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(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.ceil((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.42"};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=If.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=If.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=If.select("."+n.axisY2);if(e){s=s.transition()}}If.attr("transform",ri.main);r.attr("transform",ri.x);i.attr("transform",ri.y);s.attr("transform",ri.y2);If.select("."+n.chartArcs).attr("transform",ri.arc)}function hi(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=qf.select("."+n.axisX);if(e){r=r.transition()}}qf.attr("transform",ri.context);r.attr("transform",ri.subx)}function pi(e){(e?Rf.transition():Rf).attr("transform",ri.legend)}function di(e,t){ci(e,t);if(ot){hi(e,t)}pi(e)}function yi(){var e=Qi(),t=Ki(),n=ii?0:e,r=ka(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(){If.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=Ca(a.data.targets)||Na(a.data.targets)?Nr*e:0}function Ei(){var e=gt?n.axisX:n.axisY,t=If.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=zf.node().getBoundingClientRect(),s=ka(a.data.targets),o=r.right-i.left-(s?0:Ci());return o>0?o:0}function Si(){return p?p:Mi()}function xi(){var e=d?d:_i();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(sf(Li("x")),40)}else{return!Bt||Rt?1:sf(Li("y"))}}function ki(){var e=10,t=ii?Ki()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:sf(Li("y2")))+t}}function Li(e){var t=ys(e);return t.isInner?20+js(e):40+js(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(ys(e).isInner?30:40)+(e==="y2"?-10:0)}function Oi(e){var t=zf.node(),n;while(t&&t.tagName!=="BODY"){n=t.getBoundingClientRect()[e];if(n){break}t=t.parentNode}return n}function Mi(){return Oi("width")}function _i(){var e=zf.style("height");return e.indexOf("px")>0?+e.replace("px",""):0}function Di(e){return e?-(1+30):-(mr.left-1)}function Pi(e){return e?-20:-4}function Hi(){return Di(!gt)}function Bi(){return Pi(!gt)}function ji(){return Di(gt)}function Fi(){return Pi(gt)}function Ii(e){return e?br+2+30+30:mr.left+20}function qi(e){return e?(Dt?Dt:0)+80:Er+8}function Ri(){return Ii(!gt)}function Ui(){return qi(!gt)}function zi(){return Ii(gt)}function Wi(){return qi(gt)}function Xi(){var e=Ho(a.data.targets),t,n,r,i,s,o;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=Po();s=Sa(a.data.targets)?(i-(nr?.25:1))/i:1;o=i>1?r*s/(i-1):r;return o<1?1:o}function Vi(e){si=e}function $i(e){oi=e}function Ji(e){ui=e}function Ki(){return ct?ii?oi*(si+1):xr:0}function Qi(){return ct?ii?Tr:ui*(si+1):0}function Gi(){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=es(Pr,Hr,n?undefined:Ur.domain(),function(){return Jr.tickOffset()});zr=ts(Br,jr,n?undefined:zr.domain());Wr=ts(Br,jr,n?undefined:Wr.domain());Xr=es(Pr,Hr,Wf,function(e){return e%1?0:Gr.tickOffset()});Vr=ts(qr,Rr,n?undefined:Vr.domain());$r=ts(qr,Rr,n?undefined:$r.domain());e=us();t=Lt?Lt:n?undefined:Jr.tickValues();Jr=is(Ur,Zr,e,t);Gr=is(Xr,ni,e,t);Kr=ss(zr,ei,Ut,Wt);Qr=ss(Wr,ti,Gt,Zt);if(!n){Hf.scale(Xr);if(b){Bf.scale(Ur)}}Yi()}function Yi(){Or=qs();Mr=Rs();_r=Rs(.98)}function Zi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function es(e,t,n,r){var i=Zi(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(Wf&&Wf[0]===e[0]&&Wf[1]<e[1]){e[1]=Wf[1]}return e};if(nr){i.domain=function(e){if(!arguments.length){e=this.orgDomain();return[e[0],e[1]+1]}Wf=e;s.domain(e);return i}}return i}function ts(e,t,n){var r=Zi(e,t);if(n){r.domain(n)}return r}function ns(e){return os(e)==="y2"?Wr:zr}function rs(e){return os(e)==="y2"?$r:Vr}function is(e,t,n,r){var i=o(u,nr).scale(e).orient(t);i.tickFormat(n).tickValues(r);if(nr){i.tickCentered(St);if(Ya(Tt)){Tt=false}i.categories(Et)}else{i.tickOffset=function(){var e=Bo(a.data.targets),t=Ur(e[1])-Ur(e[0]),n=t?t:gt?Er:br;return n/Po()/2}}return i}function ss(e,t,n,r){return o(u).scale(e).orient(t).tickFormat(n).ticks(r)}function os(e){return e in H?H[e]:"y"}function us(){var e=tr?pr:nr?Zo: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 as(e){var t;if(e==="y"){t=qt}else if(e==="y2"){t=Kt}else if(e==="x"){t=Ht}return t}function fs(e){var t=as(e);return typeof t==="string"?t:t?t.text:null}function ls(e,t){var n=as(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 cs(e){return 10*Math.sin(Math.PI*(e/180))}function hs(e){return 11.5-2.5*(e/15)}function ps(e,t,n){e.selectAll(".tick text").style("text-anchor","start");t.selectAll(".tick text").attr("y",hs(n)).attr("x",cs(n)).attr("transform","rotate("+n+")")}function ds(e,t){var n=as(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 vs(){return ds("x",gt?"inner-top":"inner-right")}function ms(){return ds("y",gt?"inner-right":"inner-top")}function gs(){return ds("y2",gt?"inner-right":"inner-top")}function ys(e){return e==="y2"?gs():e==="y"?ms():vs()}function bs(){return fs("x")}function ws(){return fs("y")}function Es(){return fs("y2")}function Ss(e,t){if(e){return t.isLeft?0:t.isCenter?br/2:br}else{return t.isBottom?-Er:t.isMiddle?-Er/2:0}}function xs(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 Ts(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ns(){return Ss(!gt,vs())}function Cs(){return Ss(gt,ms())}function ks(){return Ss(gt,gs())}function Ls(){return xs(!gt,vs())}function As(){return xs(gt,ms())}function Os(){return xs(gt,gs())}function Ms(){var e=vs();if(gt){return e.isInner?"1.2em":-25-js("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function _s(){var e=ms();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-js("y")}}function Ds(){var e=gs();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+js("y2")}}function Ps(){return Ts(!gt,vs())}function Hs(){return Ts(gt,ms())}function Bs(){return Ts(gt,gs())}function js(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 Fs(e){var t=If.select("."+n.axisX+" ."+n.axisXLabel),r=If.select("."+n.axisY+" ."+n.axisYLabel),i=If.select("."+n.axisY2+" ."+n.axisY2Label);(e?t.transition():t).attr("x",Ns).attr("dx",Ls).attr("dy",Ms).text(bs);(e?r.transition():r).attr("x",Cs).attr("dx",As).attr("dy",_s).attr("dy",_s).text(ws);(e?i.transition():i).attr("x",ks).attr("dx",Os).attr("dy",Ds).text(Es)}function Is(e){var t=false;Dr(Uo(a.data.targets)).forEach(function(n){if(!t&&n.data.id===e.data.id){t=true;e=n}});if(isNaN(e.endAngle))e.endAngle=e.startAngle;if(Ha(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 qs(){var e=u.svg.arc().outerRadius(Nr).innerRadius(kr),t=function(t,n){var r;if(n){return e(t)}r=Is(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function Rs(e){var t=u.svg.arc().outerRadius(Cr*(e?e:1)).innerRadius(kr);return function(e){var n=Is(e);return n?t(n):"M 0 0"}}function Us(e,t){return ja(e.data)?Or(e,t):"M 0 0"}function zs(e){var t=Is(e),n,r,i,s,o,u="";if(t){n=Or.centroid(t);r=n[0];i=n[1];s=Math.sqrt(r*r+i*i);o=(36/Nr>.375?1.175-36/Nr:.8)*Nr/s;u=Mn=="arc"?"translate(1,1)":"translate("+r*o+","+i*o+")"}return u}function Ws(e){var t=Mn=="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Xs(e){return To({id:e.data.id,value:e.value,ratio:Ws(e)})}function Vs(e){var t,n,r,i;if(!Ks()){return""}t=Is(e);n=t?t.value:null;r=Ws(t);i=Qs();return i?i(n,r):Iu(n,r)}function $s(e,t){var r=jf.selectAll("."+n.chartArc+Nu(e)),i=jf.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Xa(e)){r.selectAll("path").transition().duration(50).attr("d",Mr).transition().duration(100).attr("d",_r).each(function(e){if(Ba(e.data)){}})}if(!t){i.style("opacity",.3)}}function Js(e){var t=jf.selectAll("."+n.chartArc+Nu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Or);jf.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Ks(){if(Na(a.data.targets)){return true}return Ca(a.data.targets)?Pn:gn}function Qs(){if(Na(a.data.targets)){return Nn}return Ca(a.data.targets)?Hn:yn}function Gs(){return Ca(a.data.targets)?jn:""}function Ys(){if(Na(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Ca(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Zs(){if(Na(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Ca(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function eo(){if(Na(a.data.targets)){return typeof On==="function"?On:function(){}}var e=Ca(a.data.targets)?qn:Sn;return typeof e==="function"?e:function(){}}function to(e){var t=jo(e),n=Ko(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(os(a)===os(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 no(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Yo(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(os(a)===os(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 ro(e,t){var n=e.filter(function(e){return os(e.id)===t}),i=t==="y2"?$t:Ft,s=t==="y2"?Vt:jt,o=r(i)?i:to(n),u=r(s)?s:no(n),a,f,l,c,h=t==="y2"?Jt:It,p,d,v,m,g=Du()&>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=Pu(o,u);v=ao(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(Sa(n)&&!Go(n)){c=o}if(en&&!Go(n)){c-=c}return[o-c,u+l]}function io(e){return Mt?tr?Ja(Mt):Mt:u.min(e,function(e){return u.min(e.values,function(e){return e.x})})}function so(e){return Ot?tr?Ja(Ot):Ot:u.max(e,function(e){return u.max(e.values,function(e){return e.x})})}function oo(e){var t=Bo(e),n=t[1]-t[0],i,s,o,u;if(nr){s=0}else if(Sa(e)){i=Po();s=i>1?n/(i-1)/2:.5}else if(en){s=n*.001}else{s=n*.01}if(typeof _t==="object"&&Za(_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 uo(e){var t=[io(e),so(e)],n=t[0],r=t[1],i=oo(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 ao(e){return e[1]-e[0]}function fo(e){for(var t=0;t<e.length;t++){if(!(e[t]in f)){return false}}return true}function lo(e,t){f[e]=Mo(t)}function co(e){var t=[];for(var n=0;n<e.length;n++){if(e[n]in f){t.push(Mo(f[e[n]]))}}return t}function ho(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?Ja(e.start):e.start):0}return t}function po(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?Ja(e.start):e.start):0:0}return t}function vo(e){var t=ho(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?Ja(e.end):e.end):br}return n<t?0:n-t}function mo(e){var t=po(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?Ja(e.end):e.end):Er:Er}return n<t?0:n-t}function go(e){return L&&e===L||Za(A)&&ef(A,e)}function yo(e){return!go(e)}function bo(e){return L?L:Za(A)?A[e]:null}function wo(e,t){var n,r=t&&Za(t)?jo(t):[];r.forEach(function(t){if(bo(t)===e){n=a.data.xs[t]}});return n}function Eo(e,t){return e in a.data.xs&&a.data.xs[e]&&a.data.xs[e][t]?a.data.xs[e][t]:t}function So(e){Object.keys(e).forEach(function(t){A[t]=e[t]})}function xo(e){return u.set(Object.keys(e).map(function(t){return e[t]})).size()===1}function To(e){var t;if(e){t=_[e.id];e.name=t?t:e.id}return e}function No(e,t){e.forEach(function(e){e.values.forEach(function(n,r){n.x=ko(t[r],e.id,r)});a.data.xs[e.id]=t})}function Co(e,t){e.forEach(function(e){if(t[e.id]){No([e],t[e.id])}})}function ko(e,t,n){var i;if(tr){i=e?e instanceof Date?e:Ja(e):Ja(Eo(t,n))}else if(rr&&!nr){i=r(e)?+e:Eo(t,n)}else{i=n}return i}function Lo(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 Ao(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 Oo(e){var t=u.keys(e[0]).filter(yo),n=u.keys(e[0]).filter(go),i;t.forEach(function(t){var i=bo(t),s;if(rr||tr){if(n.indexOf(i)>=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r).map(function(e,n){return ko(e,t,n)})}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Za(A)){a.data.xs[t]=wo(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=bo(t),o=e[s],u=ko(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){wa(jo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){lo(e.id_org,e)});return i}function Mo(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 _o(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function Do(e){return e<Po()-1?a.data.targets[0].values[e+1].x:undefined}function Po(){return u.max(a.data.targets,function(e){return e.values.length})}function Ho(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 Bo(e){var t=Ho(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 jo(e){return e.map(function(e){return e.id})}function Fo(e){return e?typeof e==="string"?[e]:e:jo(a.data.targets)}function Io(e,t){var n=jo(e),r;for(r=0;r<n.length;r++){if(n[r]===t){return true}}return false}function qo(e){return dr.indexOf(e)<0}function Ro(e){return vr.indexOf(e)<0}function Uo(e){return e.filter(function(e){return qo(e.id)})}function zo(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 Wo(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 Xo(e){dr=dr.concat(e)}function Vo(e){dr=dr.filter(function(t){return e.indexOf(t)<0})}function $o(e){vr=vr.concat(e)}function Jo(e){vr=vr.filter(function(t){return e.indexOf(t)<0})}function Ko(e){var t={};e.forEach(function(e){t[e.id]=[];e.values.forEach(function(n){t[e.id].push(n.value)})});return t}function Qo(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 Go(e){return Qo(e,function(e){return e<0})}function Yo(e){return Qo(e,function(e){return e>0})}function Zo(e){return e<Et.length?Et[e]:e}function eu(e,t){return" "+e+" "+e+Tu(t)}function tu(e){return eu(n.text,e.id)}function nu(e){return eu(n.texts,e.id)}function ru(e,t){return eu(n.shape,t)}function iu(e){return eu(n.shapes,e.id)}function su(e){return ru(e)+eu(n.line,e.id)}function ou(e){return iu(e)+eu(n.lines,e.id)}function uu(e,t){return ru(e,t)+eu(n.circle,t)}function au(e){return iu(e)+eu(n.circles,e.id)}function fu(e,t){return ru(e,t)+eu(n.bar,t)}function lu(e){return iu(e)+eu(n.bars,e.id)}function cu(e){return ru(e.data)+eu(n.arc,e.data.id)}function hu(e){return iu(e.data)+eu(n.arcs,e.data.id)}function pu(e){return ru(e)+eu(n.area,e.id)}function du(e){return iu(e)+eu(n.areas,e.id)}function vu(e,t){return eu(n.region,t)+" "+("class"in e?e.class:"")}function mu(e,t){return eu(n.eventRect,t)}function gu(e){return ru(e)+eu(n.step,e.id)}function yu(e){return iu(e)+eu(n.steps,e.id)}function bu(e){var t=D[e],r="";if(t){r=" "+n.target+"-"+t}return eu(n.target,e)+r}function wu(e){return n.chartText+bu(e.id)}function Eu(e){return n.chartLine+bu(e.id)}function Su(e){return n.chartBar+bu(e.id)}function xu(e){return n.chartArc+bu(e.data.id)}function Tu(e){return e||e===0?"-"+(e.replace?e.replace(/([^a-zA-Z0-9-_])/g,"-"):e):""}function Nu(e){return"."+n.target+Tu(e)}function Cu(e){return e.length?e.map(function(e){return Nu(e)}):null}function ku(e){return"."+n.legendItem+Tu(e)}function Lu(e){return e.length?e.map(function(e){return ku(e)}):null}function Au(e){return e.value!==null&&Vf[e.id]?1:0}function Ou(e){var t=_u(e);return Au(e)*t}function Mu(e){return r(e.value)?Da(e)?.5:1:0}function _u(){return Du()?1:0}function Du(){if(typeof F==="boolean"&&F){return true}else if(typeof F==="object"&&Za(F)){return true}return false}function Pu(e,t){var n=[],r=1.3;zf.select("svg").selectAll(".dummy").data([e,t]).enter().append("text").text(function(e){return qu(e.id)(e.value,e.id)}).each(function(e,t){n[t]=this.getBoundingClientRect().width*r}).remove();return n}function Hu(e){var t=e&&!Na(a.data.targets)?Iu:Bu,n=e&&!Na(a.data.targets)?Iu:ju;return function(e,r,i){var s=os(i)==="y2"?n:t;return s(e,r)}}function Bu(e){var t=Ut?Ut:Fu;return t(e)}function ju(e){var t=Gt?Gt:Fu;return t(e)}function Fu(e){return r(e)?+e:""}function Iu(e,t){return(t*100).toFixed(1)+"%"}function qu(e){var t=function(e){return r(e)?+e:""},n=os(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 Ru(e){return e?Ur(e.x):null}function Uu(e){return Math.ceil(Ur(tr?Ja(e.value):e.value))}function zu(e){var t=e.axis&&e.axis==="y2"?Wr:zr;return Math.ceil(t(e.value))}function Wu(e){return e?Xr(e.x):null}function Xu(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 Vu(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(Xu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Xu(e,s))}return Ju(f,t)}return Vu(e,t,i,s)}function $u(e,t){var n;n=e.map(function(e){return Vu(e.values,t)});return Ju(n,t)}function Ju(e,t){var n,r;e.forEach(function(e){var i=tf(e,t);if(i<n||!n){n=i;r=e}});return r}function Ku(e,t){return u.merge(e.map(function(e){return e.values})).filter(function(e){return e.x-t===0})}function Qu(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 Gu(){return I&&I.toLowerCase()==="desc"}function Yu(){return I&&I.toLowerCase()==="asc"}function Zu(e){var t=Yu(),n=Gu();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 ea(e,t){var n,i,s,o,u,f,l;var c=ka(a.data.targets),h=e.filter(function(e){return e&&r(e.value)});if(h.length===0||!Un){return}Uf.html(Xn(e,us(),Hu(c),lr)).style("display","block");n=Uf.property("offsetWidth");i=Uf.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-=u-l}if(f+i>xi()){f-=i+30}}Uf.style("top",f+"px").style("left",o+"px")}function ta(){Uf.style("display","none")}function na(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Un){return}if(xa(a.data.targets)||ka(a.data.targets)){return}var i=If.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",Ru).attr(gt?"y2":"x2",Ru);tl(i,"grid")}function ra(){If.select("line."+n.xgridFocus).style("visibility","hidden")}function ia(e,t){var r=[],i,s,o,u,a=If.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=uo();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 sa(e){return e.x||e.x===0?Ur(e.x):null}function oa(e,t){var n=ma(),r=Df(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ns(e.id)(e.value)}function ua(){var e={},t=0,n,r;Uo(a.data.targets.filter(_a)).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 aa(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 fa(e){return function(t){var n=e?rs(t.id):ns(t.id);return n(t.value)}}function la(e,t){var n=Zu(Uo(a.data.targets.filter(_a))),r=n.map(function(e){return e.id});return function(i,s){var o=t?rs(i.id):ns(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 ca(e,t){return typeof vn==="number"?vn:t?e.tickOffset()*2*mn/t:0}function ha(){var e={},t=0,n,r;Uo(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 pa(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 da(e){return function(t){var n=e?rs(t.id):ns(t.id);return n(t.value)}}function va(e,t){var n=Zu(Uo(a.data.targets.filter(Ma))),r=n.map(function(e){return e.id});return function(i,s){var o=t?rs(i.id):ns(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 ma(){var e={},t=0,n,r;Uo(a.data.targets.filter(La)).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 ga(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 ya(e){return function(t){var n=e?rs(t.id):ns(t.id);return n(t.value)}}function ba(e,t){var n=Zu(Uo(a.data.targets.filter(La))),r=n.map(function(e){return e.id});return function(i,s){var o=t?rs(i.id):ns(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 wa(e,t){Fo(e).forEach(function(e){Vf[e]=t===j[e];j[e]=t});if(!e){B=t}}function Ea(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 Sa(e){return Ea(e,"bar")}function xa(e){return Ea(e,"scatter")}function Ta(e){return B==="pie"||Ea(e,"pie")}function Na(e){return Ea(e,"gauge")}function Ca(e){return B==="donut"||Ea(e,"donut")}function ka(e){return Ta(e)||Ca(e)||Na(e)}function La(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 Aa(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ba(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function ja(e){return Pa(e)||Ba(e)||Ha(e)}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Aa(e)?[e]:[]}function qa(e){return ja(e.data)?[e]:[]}function Ra(e){return _a(e)?e.values:[]}function Ua(e){return La(e)||Da(e)?e.values:[]}function za(e){return La(e)||Aa(e)?[e]:[]}function Wa(e){return _a(e)||La(e)?e.values:[]}function Xa(e){return Ba(e)&&Bn||Pa(e)&&bn}function Va(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 $a(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 Ja(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 Ka(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 Qa(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 Ga(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 Ya(e){return!e||typeof e==="string"&&e.length===0||typeof e==="object"&&Object.keys(e).length===0}function Za(e){return Object.keys(e).length>0}function ef(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function tf(e,t){var n=os(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 nf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function rf(e,t,n){return s(e[t])?e[t]:n}function sf(e){return Math.ceil(e/10)*10}function of(e,t){var n;u.select("body").selectAll(".dummy").data([e]).enter().append("text").classed(t?t:"",true).text(e).each(function(){n=this.getBoundingClientRect()}).remove();return n}function uf(e,t,r){Y(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return eu(n.selectedCircle,r)}).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa).attr("stroke",function(){return lr(t)}).attr("r",yf(t)*1.4).transition().duration(100).attr("r",yf)}function af(e,t,r){Z(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function ff(e,t,n,r){e?uf(t,n,r):af(t,n,r)}function lf(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(lr(t)).brighter(.75)})}function cf(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return lr(t)})}function hf(e,t,n,r){e?lf(t,n,r):cf(t,n,r)}function pf(e,t,n,r){hf(e,t,n.data,r)}function df(e){return e.nodeName==="circle"?ff:u.select(e).classed(n.bar)?hf:pf}function vf(e){return e.filter(function(e){return r(e.value)})}function mf(e){return an?typeof fn==="function"?fn(e):fn:0}function gf(e){return cn?hn?hn:mf(e)*1.75:mf(e)}function yf(e){return pn?pn:mf(e)*4}function bf(e,t){return(t?If.selectAll("."+n.circles+Tu(t)):If).selectAll("."+n.circle+(r(e)?"-"+e:""))}function wf(e,t){bf(e,t).classed(n.EXPANDED,true).attr("r",gf)}function Ef(e){bf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",mf)}function Sf(e){return If.selectAll("."+n.bar+(r(e)?"-"+e:""))}function xf(e){Sf(e).classed(n.EXPANDED,true)}function Tf(e){Sf(e).classed(n.EXPANDED,false)}function Nf(e,t){var n,r=Mf(e,t),i=t?rs:ns;if(gt){n=u.svg.area().x0(function(e,t){return i(e.id)(0)}).x1(function(e,t){return i(e.id)(e.value)}).y(Ru)}else{n=u.svg.area().x(Ru).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return i(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return i(e.id)(e.value)})}return function(e,t){var r=vf(e.values),i,s;if(Ea([e],"area")||Ea([e],"area-spline")){Oa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(Ea([e],"area-step")){Aa(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=Ur(r[0].x);s=ns(e.id)(r[0].value);return gt?"M "+s+" "+i:"M "+i+" "+s}}}function Cf(e,t){var n=Df(e,t),r=t?rs:ns,i=t?Wu:Ru,s=function(e,t){if(P.length>0){var i=n(e,t);return i[0][1]}return r(e.id)(e.value)},o=u.svg.line().x(gt?s:i).y(gt?i:s);if(!dn){o=o.defined(function(e){return e.value!=null})}return function(e){var n=dn?vf(e.values):e.values,i=t?i:Xr,s=r(e.id),u=0,a=0;if(La(e)){if(q[e.id]){return Pf(n,i,s,q[e.id])}else{o.interpolate(Oa(e)?"cardinal":"linear");return o(n)}}else if(Aa(e)){o.interpolate("step-after");return o(n)}else{if(n[0]){u=i(n[0].x);a=s(n[0].value)}return gt?"M "+a+" "+u:"M "+u+" "+a}}}function kf(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 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=_a(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:_a(t)?-3:-6)}}function Mf(e,t){var n=e.__max__+1,r=pa(n,e,!!t),i=da(!!t),s=va(e,!!t),o=t?rs:ns;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=ca(Jr,n),i=aa(r,n,e,!!t),s=fa(!!t),o=la(e,!!t),u=t?rs:ns;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=ga(n,e,!!t),i=ya(!!t),s=ba(e,!!t),o=t?rs:ns;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 Pf(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?Ja(r[u].start):r[u].start}if(i(r[u].end)){w[u].end=e[e.length-1].x}else{w[u].end=tr?Ja(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)||!Ga(e[u].x,w)){f+=" "+y(e[u])+" "+b(e[u])}else{c=Zi(e[u-1].x,e[u].x,tr);h=Zi(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 $f(t){var n=new MutationObserver(function(r){r.forEach(function(r){if(r.type==="childList"&&r.previousSibling){n.disconnect();var i=e.setInterval(function(){if(t.node().parentNode){e.clearInterval(i);nl({withUpdateTranslate:true,withTransform:true,withUpdateXDomain:true,withUpdateOrgXDomain:true,withTransition:false,withTransitionForTransform:false,withLegend:true});t.transition().style("opacity",1)}},10)}})});n.observe(t.node(),{attributes:true,childList:true,characterData:true})}function Jf(t){var r,i,s,o=true;zf=u.select(h);if(zf.empty()){zf=u.select(document.createElement("div")).style("opacity",0);$f(zf);o=false}zf.html("").classed("c3",true);a.data.xs={};a.data.targets=Oo(t);if(W){a.data.targets=a.data.targets.filter(W)}if(z){Xo(z===true?jo(a.data.targets):z)}yi();Gi();Ur.domain(u.extent(uo(a.data.targets)));zr.domain(ro(a.data.targets,"y"));Wr.domain(ro(a.data.targets,"y2"));Xr.domain(Ur.domain());Vr.domain(zr.domain());$r.domain(Wr.domain());Wf=Ur.domain();Hf.scale(Xr);if(b){Bf.scale(Ur)}jf=zf.append("svg").style("overflow","hidden").on("mouseenter",x).on("mouseleave",T);Ff=jf.append("defs");Ff.append("clipPath").attr("id",Kn).append("rect");Ff.append("clipPath").attr("id",Qn).append("rect");Ff.append("clipPath").attr("id",Gn).append("rect");ol();If=jf.append("g").attr("transform",ri.main);qf=jf.append("g").attr("transform",ri.context);Rf=jf.append("g").attr("transform",ri.legend);if(!ot){qf.style("visibility","hidden")}if(!ct){Rf.style("visibility","hidden");vr=jo(a.data.targets)}Uf=zf.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none");bl(jo(a.data.targets),{withTransform:false,withTransitionForTransform:false});if(a.data.targets.length==0){If.append("text").attr("class",n.text).attr("x",If[0][0].parentNode.width.baseVal.value/2-mr.left).attr("y",If[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=If.append("g").attr("clip-path",Yn).attr("class",n.grid);if(tn){i.append("g").attr("class",n.xgrids)}if(Za(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(Za(on)){i.append("g").attr("class",n.ygridLines)}If.append("g").attr("clip-path",Yn).attr("class",n.regions);If.append("g").attr("clip-path",Yn).attr("class",n.chart);r=If.select("."+n.chart).append("g").attr("class",n.eventRects).style("fill-opacity",0).style("cursor",b?gt?"ns-resize":"ew-resize":null);If.select("."+n.chart).append("g").attr("class",n.chartBars);If.select("."+n.chart).append("g").attr("class",n.chartLines);If.select("."+n.chart).append("g").attr("class",n.chartArcs).attr("transform",ri.arc).append("text").attr("class",n.chartArcsTitle).style("text-anchor","middle").text(Gs());If.select("."+n.chart).append("g").attr("class",n.chartTexts);if(b){If.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(Bf).on("dblclick.zoom",null)}if(Pt){Hf.extent(typeof Pt!=="function"?Pt:Pt(uo()))}Yr.x=If.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",Ps);Yr.y=If.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",Hs);Yr.y2=If.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",Bs);qf.append("g").attr("clip-path",Yn).attr("class",n.chart);qf.select("."+n.chart).append("g").attr("class",n.chartBars);qf.select("."+n.chart).append("g").attr("class",n.chartLines);qf.append("g").attr("clip-path",Yn).attr("class",n.brush).call(Hf).selectAll("rect").attr(gt?"width":"height",gt?wr:Sr);Yr.subx=qf.append("g").attr("class",n.axisX).attr("transform",ri.subx).attr("clip-path",gt?"":Zn);fl(a.data.targets);if(o){nl({withUpdateTranslate:true,withTransform:true,withUpdateXDomain:true,withUpdateOrgXDomain:true,withTransitionForAxis:false})}if(Vn){if(tr&&typeof $n==="string"){$n=Ja($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}Uf.html(Xn(a.data.targets.map(function(e){return To(e.values[$n])}),us(),Hu(ka(a.data.targets)),lr));Uf.style("top",Jn.top).style("left",Jn.left).style("display","block")}if(e.onresize==null){e.onresize=sl()}if(e.onresize.add){e.onresize.add(N);e.onresize.add(function(){a.flush()});e.onresize.add(C)}a.element=zf.node()}function Kf(e){e.append("rect").attr("class",mu).style("cursor",X&&V?"pointer":null).on("mouseover",function(e,t){if(sr){return}if(ka(a.data.targets)){return}var r=a.data.targets.map(function(e){return To(e.values[t])}),i=[];Object.keys(_).forEach(function(e){for(var t=0;t<r.length;t++){if(r[t]&&r[t].id===e){i.push(r[t]);r.shift(t);break}}});r=i.concat(r);if(cn){wf(t)}xf(t);If.selectAll("."+n.shape+"-"+t).each(function(e){Q(e)})}).on("mouseout",function(e,t){if(ka(a.data.targets)){return}ra();ta();Ef(t);Tf();If.selectAll("."+n.shape+"-"+t).each(function(e){G(e)})}).on("mousemove",function(e,t){var r;if(sr){return}if(ka(a.data.targets)){return}r=Uo(a.data.targets).map(function(e){return To(e.values[t])});ea(r,u.mouse(this));na(r);if(!X){return}if(V){return}If.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",gf)}jf.select("."+n.eventRect+"-"+t).style("cursor",null)}).filter(function(e){if(this.nodeName==="circle"){return Ka(this,yf(e))}else if(this.nodeName==="path"){return Qa(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",yf)}}jf.select("."+n.eventRect+"-"+t).style("cursor","pointer")})}).on("click",function(e,t){if(ka(a.data.targets)){return}if(or){or=false;return}If.selectAll("."+n.shape+"-"+t).each(function(e){Gf(this,e,t)})}).call(u.behavior.drag().origin(Object).on("drag",function(){Yf(u.mouse(this))}).on("dragstart",function(){Zf(u.mouse(this))}).on("dragend",function(){el()})).call(Bf).on("dblclick.zoom",null)}function Qf(e){e.append("rect").attr("x",0).attr("y",0).attr("width",br).attr("height",Er).attr("class",n.eventRect).on("mouseout",function(){if(ka(a.data.targets)){return}ra();ta();Ef()}).on("mousemove",function(){var e=Uo(a.data.targets);var t,r,i,s;if(sr){return}if(ka(e)){return}t=u.mouse(this);r=$u(e,t);if(!r){return}if(Da(r)){i=[r]}else{i=Ku(e,r.x)}s=i.map(function(e){return To(e)});ea(s,t);if(cn){Ef();wf(r.index,r.id)}na(s);if(tf(r,t)<100){jf.select("."+n.eventRect).style("cursor","pointer");if(!ur){Q(r);ur=true}}else{jf.select("."+n.eventRect).style("cursor",null);G(r);ur=false}}).on("click",function(){var e=Uo(a.data.targets);var t,r;if(ka(e)){return}t=u.mouse(this);r=$u(e,t);if(!r){return}if(tf(r,t)<100){If.select("."+n.circles+"-"+Tu(r.id)).select("."+n.circle+"-"+r.index).each(function(){Gf(this,r,r.index)})}}).call(u.behavior.drag().origin(Object).on("drag",function(){Yf(u.mouse(this))}).on("dragstart",function(){Zf(u.mouse(this))}).on("dragend",function(){el()})).call(Bf).on("dblclick.zoom",null)}function Gf(e,t,r){var i=u.select(e),s=i.classed(n.SELECTED),o,a;if(e.nodeName==="circle"){o=Ka(e,yf(t)*1.5);a=ff}else if(e.nodeName==="path"){if(i.classed(n.bar)){o=Qa(e);a=hf}else{o=true;a=pf}}if(V||o){if(X&&$(t)){if(!J){If.selectAll("."+n.shapes+(V?Tu(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 Yf(e){var t,r,i,s,o,f,l,c;if(ka(a.data.targets)){return}if(!X){return}if(b&&!Bf.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);If.select("."+n.dragarea).attr("x",o).attr("y",l).attr("width",f-o).attr("height",c-l);If.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=ff;m=o<a&&a<f&&l<h&&h<c}else if(r.classed(n.bar)){g=Qu(this);a=g.x;h=g.y;p=g.width;d=g.height;v=hf;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 Zf(e){if(ka(a.data.targets)){return}if(!X){return}ir=e;If.select("."+n.chart).append("rect").attr("class",n.dragarea).style("opacity",.1);sr=true;et()}function el(){if(ka(a.data.targets)){return}if(!X){return}If.select("."+n.dragarea).transition().duration(100).style("opacity",0).remove();If.selectAll("."+n.shape).classed(n.INCLUDED,false);sr=false;tt()}function tl(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 nl(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 _=ha(),D=ua(),P=ma(),H,B;var j,F;var I,q,R,U,z,W,X,V,J,K;var Q=ka(a.data.targets);var G,Y,Z,et,tt,rt,it,st;var ut,at,ht;var pt=Uo(a.data.targets),dt,vt,mt;if(pt.length===0&&nt){return}e=e||{};I=rf(e,"withY",true);q=rf(e,"withSubchart",true);R=rf(e,"withTransition",true);W=rf(e,"withTransform",false);X=rf(e,"withUpdateXDomain",false);V=rf(e,"withUpdateOrgXDomain",false);K=rf(e,"withUpdateTranslate",false);J=rf(e,"withLegend",false);U=rf(e,"withTransitionForExit",R);z=rf(e,"withTransitionForAxis",R);ut=R?k:0;at=U?ut:0;ht=z?ut:0;t=t||ul(ht);if(K){if(gt){Yr.x.call(Jr);Yr.subx.call(Gr)}else{Yr.y.call(Kr);Yr.y2.call(Qr)}yi();Gi();ol();di(false)}if(J&&ct){bl(jo(a.data.targets),e,t)}if(nr&&pt.length===0){Ur.domain([0,Yr.x.selectAll(".tick").size()])}if(pt.length){if(V){Ur.domain(u.extent(uo(pt)));Wf=Ur.domain();if(b){Bf.scale(Ur).updateScaleExtent()}Xr.domain(Ur.domain());Hf.scale(Xr)}if(X){Ur.domain(Hf.empty()?Wf:Hf.extent());if(b){Bf.scale(Ur).updateScaleExtent()}}if(!Lt&&(kt||Ct)){dt=Wo(zo(pt),Ct);Jr.tickValues(dt);Gr.tickValues(dt)}}zr.domain(ro(pt,"y"));Wr.domain(ro(pt,"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);Fs(R);if(X&&pt.length){if(Tt&&dt){for(vt=1;vt<dt.length;vt++){if(dt.length/vt<Nt){mt=vt;break}}jf.selectAll("."+n.axisX+" .tick text").each(function(e){var t=dt.indexOf(e);if(t>=0){u.select(this).style("display",t%mt?"none":"block")}})}else{jf.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){ps(Yr.x,t.axisX,At)}G=Nf(_,false);Z=kf(D);tt=Cf(P,false);it=Lf(D,true);st=Lf(D,false);Vr.domain(zr.domain());$r.domain(Wr.domain());Uf.style("display","none");bi();If.select("line."+n.xgridFocus).style("visibility","hidden");if(tn){o=ia(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=If.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(Za(rn)){f=If.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(ut).attr("x1",gt?0:Uu).attr("x2",gt?br:Uu).attr("y1",gt?Uu:mr.top).attr("y2",gt?Uu:Er).style("opacity",1);f.select("text").transition().duration(ut).attr("x",gt?br:0).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(ut).style("opacity",0).remove()}if(I&&sn){c=If.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();tl(c,"grid")}if(I&&Za(on)){h=If.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(ut).attr("x1",gt?zu:0).attr("x2",gt?zu:br).attr("y1",gt?0:zu).attr("y2",gt?Er:zu).style("opacity",1);h.select("text").transition().duration(ut).attr("x",gt?0:br).attr("y",zu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(ut).style("opacity",0).remove()}E=If.select("."+n.regions).selectAll("."+n.region).data(Rn);E.enter().append("g").attr("class",vu).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(ut).attr("x",ho).attr("y",po).attr("width",vo).attr("height",mo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(ut).style("opacity",0).remove();y=If.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);y.enter().append("path").attr("class",fu).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 Au});y.style("opacity",Au).transition().duration(ut).attr("d",Z).style("fill",lr).style("opacity",1);y.exit().transition().duration(at).style("opacity",0).remove();d=If.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);d.enter().append("path").attr("class",su).style("stroke",lr);d.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);d.exit().transition().duration(at).style("opacity",0).remove();v=If.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);v.enter().append("path").attr("class",gu).style("stroke",lr);v.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);v.exit().transition().duration(at).style("opacity",0).remove();m=If.selectAll("."+n.areas).selectAll("."+n.area).data(za);m.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(ut).attr("d",G).style("fill",lr).style("opacity",Xf);m.exit().transition().duration(at).style("opacity",0).remove();if(an){g=If.selectAll("."+n.circles).selectAll("."+n.circle).data(Ua);g.enter().append("circle").attr("class",uu).attr("r",mf).style("fill",lr);g.style("opacity",Au).transition().duration(ut).style("opacity",Mu).style("fill",lr).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);g.exit().remove()}if(Du()){x=If.selectAll("."+n.texts).selectAll("."+n.text).data(Wa);x.enter().append("text").attr("class",tu).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 qu(e.id)(e.value,e.id)}).style("fill-opacity",Ou).transition().duration(ut).attr("x",it).attr("y",st).style("fill",lr).style("fill-opacity",_u);x.exit().transition().duration(at).style("fill-opacity",0).remove()}w=If.selectAll("."+n.arcs).selectAll("."+n.arc).data(qa);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 Us(e,true)});w.exit().transition().duration(at).style("opacity",0).remove()}w.enter().append("path").attr("class",cu).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=Is(e);r=Xs(n);i=Zs();$s(n.data.id);vl(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Is(e),n=Xs(t),r=[n];ea(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=eo();Js(n.data.id);ml();ta();i(r,t)}).on("click",function(e,t){var n=Is(e),r=Xs(n),i=Ys();Gf(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(ut).attrTween("d",function(e){var t=Is(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 Us(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return Mn==="arc"&<?cr(e.data.values[0].value):lr(e.data.id)}).style("opacity",ft?ft:1).call(nf,function(){ar=false});w.exit().transition().duration(at).style("opacity",0).remove();If.selectAll("."+n.chartArc).select("text").style("opacity",0).text(Vs).attr("transform",zs).transition().duration(ut).style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});if(Mn==="arc"){If.selectAll("."+n.chartArc).select("text.units").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?_n:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.min").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?kn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.max").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?Cn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0})}If.select("."+n.chartArcsTitle).style("opacity",Ca(a.data.targets)||Na(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){Hf.extent(Ur.orgDomain()).update()}if(q){if(!gt&&At){ps(Yr.subx,t.axisSubX,At)}if(!Hf.empty()){Hf.extent(Ur.orgDomain()).update()}Y=Nf(_,true);et=kf(D,true);rt=Cf(P,true);L=qf.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);L.enter().append("path").attr("class",fu).style("stroke","none").style("fill",lr);L.style("opacity",Au).transition().duration(ut).attr("d",et).style("opacity",1);L.exit().transition().duration(ut).style("opacity",0).remove();T=qf.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);T.enter().append("path").attr("class",su).style("stroke",lr);T.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);T.exit().transition().duration(ut).style("opacity",0).remove();N=qf.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);N.enter().append("path").attr("class",su).style("stroke",lr);N.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);N.exit().transition().duration(ut).style("opacity",0).remove();C=qf.selectAll("."+n.areas).selectAll("."+n.area).data(Aa?Ia:Fa);C.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(ut).attr("d",Y).style("fill",lr).style("opacity",Xf);C.exit().transition().duration(at).style("opacity",0).remove()}}If.selectAll("."+n.selectedCircles).filter(function(e){return _a(e)}).selectAll("circle").remove();If.selectAll("."+n.selectedCircle).transition().duration(ut).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);if(S){O=If.select("."+n.eventRects);if(Za(A)&&!xo(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Qf(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||tr)&&!nr){F=function(e,t){var n=_o(t),r=Do(t),i=a.data.xs[e.id][t];var s=Ur(r?r:i);var o=Ur(n?n:i);return(s-o)/2};j=function(e,t){var n=_o(t),r=a.data.xs[e.id][t];return(Ur(r)+Ur(n?n:r))/2}}else{F=Xi();j=function(e){return Ur(e.x)-F/2}}H=Ho(a.data.targets);If.select("."+n.eventRects).datum(H?H.values:[]);M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Kf(M.enter());M.attr("class",mu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?br:F).attr("height",gt?F:Er);M.exit().remove()}}jo(a.data.targets).forEach(function(e){Vf[e]=true})}function rl(){nl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function il(){if(Uo(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Bf.altDomain){Ur.domain(Bf.altDomain);Bf.scale(Ur).updateScaleExtent();return}if(nr&&Ur.orgDomain()[0]===Wf[0]){Ur.domain([Wf[0]-1e-10,Ur.orgDomain()[1]])}nl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){or=true}}function sl(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function ol(){jf.attr("width",xr).attr("height",Tr);jf.select("#"+Kn).select("rect").attr("width",br).attr("height",Er);jf.select("#"+Qn).select("rect").attr("x",Hi).attr("y",Bi).attr("width",Ri).attr("height",Ui);jf.select("#"+Gn).select("rect").attr("x",ji).attr("y",Fi).attr("width",zi).attr("height",Wi);jf.select("."+n.zoomRect).attr("width",br).attr("height",Er);zf.style("max-height",Tr+"px")}function ul(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 al(e){var t;e=e||{};e.withTransition=rf(e,"withTransition",true);e.withTransform=rf(e,"withTransform",false);e.withLegend=rf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=ul(e.withTransitionForAxis?k:0);yi();Gi();ol();di(e.withTransition,t)}nl(e,t)}function fl(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=If.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",wu);f=a.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",nu);s=If.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);i=s.enter().append("g").attr("class",Su).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",lu).style("cursor",function(e){return $(e)?"pointer":null});r=If.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);t=r.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",ou);t.append("g").attr("class",yu);t.append("g").attr("class",du);t.append("g").attr("class",function(e){return eu(n.selectedCircles,e.id)});t.append("g").attr("class",au).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){If.selectAll("."+n.selectedCircles+Tu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=If.select("."+n.chartArcs).selectAll("."+n.chartArc).data(Dr(e)).attr("class",xu);o=u.enter().append("g").attr("class",xu);o.append("g").attr("class",hu);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=qf.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);h=p.enter().append("g").style("opacity",0).attr("class",Su);h.append("g").attr("class",lu);c=qf.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);l=c.enter().append("g").style("opacity",0).attr("class",Eu);l.append("g").attr("class",ou);l.append("g").attr("class",yu);l.append("g").attr("class",du)}jf.selectAll("."+n.target).filter(function(e){return qo(e.id)}).transition().duration(k).style("opacity",1)}function ll(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?wa(e.id,t.types[e.id]):wa(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);fl(a.data.targets);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t.done==="function"){t.done()}}function cl(e){if("data"in e){ll(Oo(e.data),e)}else if("url"in e){u.csv(e.url,function(t,n){ll(Oo(n),e)})}else if("rows"in e){ll(Oo(Lo(e.rows)),e)}else if("columns"in e){ll(Oo(Ao(e.columns)),e)}else{throw Error("url or rows or columns is required.")}}function hl(e,t){if(typeof t!=="function"){t=function(){}}e=e.filter(function(e){return Io(a.data.targets,e)});if(!e||e.length===0){t();return}jf.selectAll(e.map(function(e){return Nu(e)})).transition().style("opacity",0).remove().call(nf,t);e.forEach(function(e){Vf[e]=false;Rf.selectAll("."+n.legendItem+Tu(e)).remove();a.data.targets=a.data.targets.filter(function(t){return t.id!==e})})}function pl(e){return e.classed(n.legendItemHidden)?ai:1}function dl(e){return e.classed(n.legendItemHidden)?ai:.3}function vl(e,t){Rf.selectAll("."+n.legendItem).transition().duration(100).style("opacity",function(n){var r=u.select(this);if(e&&n!==e){return t?dl(r):pl(r)}else{return t?pl(r):dl(r)}})}function ml(){Rf.selectAll("."+n.legendItem).transition().duration(100).style("opacity",function(){return pl(u.select(this))})}function gl(e){if(!ct){ct=true;Rf.style("visibility","visible")}Jo(e);Rf.selectAll(Lu(e)).style("visibility","visible").transition().style("opacity",function(){return pl(u.select(this))})}function yl(e){if(ct&&Ya(e)){ct=false;Rf.style("visibility","hidden")}$o(e);Rf.selectAll(Lu(e)).style("opacity",0).style("visibility","hidden")}function bl(e,t,r){function D(t,r,i){function h(e,t){if(!t){l=(f-b-a)/2;if(l<g){l=(f-a)/2;b=0;N++}}T[e]=N;x[N]=l;w[e]=b;b+=a}var s=of(t.textContent,n.legendItem),o=Math.ceil((s.width+d)/10)*10,u=Math.ceil((s.height+p)/10)*10,a=ii?u:o,f=ii?Qi():Ki(),l,c;if(i){b=0;N=0;v=0;m=0}if(ct&&!Ro(r)){E[r]=S[r]=T[r]=w[r]=0;return}E[r]=o;S[r]=u;if(!v||o>=v){v=o}if(!m||u>=m){m=u}c=ii?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});l=(f-c*e.length)/2;if(l<g){b=0;N=0;e.forEach(function(e){h(e)})}else{h(r,true)}}else{h(r)}}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=Rf.selectAll("."+n.legendItemFocused).size();var A,O,M;t=t||{};C=rf(t,"withTransition",true);k=rf(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=Rf.selectAll("."+n.legendItem).data(e).enter().append("g").attr("class",function(e){return eu(n.legendItem,e)}).style("visibility",function(e){return Ro(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=Rf.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=Rf.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=Rf.selectAll("rect."+n.legendItemTile).data(e);(C?M.transition():M).style("fill",lr).attr("x",i).attr("y",l);Rf.selectAll("."+n.legendItem).classed(n.legendItemHidden,function(e){return!qo(e)}).transition().style("opacity",function(e){var t=u.select(this);if(qo(e)){return!L||t.classed(n.legendItemFocused)?pl(t):dl(t)}else{return ai}});$i(v);Ji(m);Vi(N);yi();Gi();ol();di(k,r)}function wl(e){return Io(a.data.targets,e.id)}function El(e){return"data"in e&&Io(a.data.targets,e.data.id)}function Sl(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 xl(e,t,n){var r=!ka(a.data.targets);ar=false;wa(e,t);al(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"&<?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="c3-"+ +(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||Za(A));var ir=null,sr=false,or=false,ur=false,ar=false;var fr=u.scale.category10().range(),lr=Va(U,Za(at)?at:fr,R),cr=$a(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 Hf,Bf=function(){};Hf=u.svg.brush().on("brush",rl);Hf.update=function(){if(qf){qf.select("."+n.brush).call(this)}return this};Hf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Bf=u.behavior.zoom().on("zoomstart",function(){Bf.altDomain=u.event.sourceEvent.altKey?Ur.orgDomain():null}).on("zoom",b?il:null);Bf.scale=function(e){return gt?this.y(e):this.x(e)};Bf.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Po()/e[1],e[1])]};Bf.updateScaleExtent=function(){var e=ao(Ur.orgDomain())/ao(Wf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var jf,Ff,If,qf,Rf,Uf,zf;var Wf;var Xf,Vf={};a.focus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(ka(a.data.targets)){$s(e,true)}vl(e,true)};a.defocus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",.3)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}vl(e,false)};a.revert=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}ml()};a.show=function(e,t){e=Fo(e);t=t||{};Vo(e);jf.selectAll(Cu(e)).transition().style("opacity",1);if(t.withLegend){gl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=Fo(e);t=t||{};Xo(e);jf.selectAll(Cu(e)).transition().style("opacity",0);if(t.withLegend){yl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){qo(e)?a.hide(e):a.show(e)};a.unzoom=function(){Hf.clear().update();nl({withUpdateXDomain:true})};a.load=function(e){if(e.xs){So(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&&fo(e.cacheIds)){ll(co(e.cacheIds),e.done);return}if("unload"in e){hl(Fo(typeof e.unload==="boolean"&&e.unload?null:e.unload),function(){cl(e)})}else{cl(e)}};a.unload=function(e,t){hl(Fo(e),function(){nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t==="function"){t()}})};a.selected=function(e){return u.merge(If.selectAll("."+n.shapes+Tu(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}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,o){var a=u.select(this),f=i.data?i.data.id:i.id,l=df(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}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=df(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){xl(e,"line")};a.toSpline=function(e){xl(e,"spline")};a.toBar=function(e){xl(e,"bar")};a.toScatter=function(e){xl(e,"scatter")};a.toArea=function(e){xl(e,"area")};a.toAreaSpline=function(e){xl(e,"area-spline")};a.toPie=function(e){xl(e,"pie",{withTransform:true})};a.toDonut=function(e){xl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;nl();return P};a.xgrids=function(e){if(!e){return rn}rn=e;nl();return rn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(rn.concat(e))};a.xgrids.remove=function(e){var t=Sl(e);return a.xgrids(rn.filter(t))};a.ygrids=function(e){if(!e){return on}on=e;nl();return on};a.ygrids.add=function(e){if(!e){return}return a.ygrids(on.concat(e))};a.ygrids.remove=function(e){var t=Sl(e);return a.ygrids(on.filter(t))};a.regions=function(e){if(!e){return Rn}Rn=e;nl();return Rn};a.regions.add=function(e){if(!e){return Rn}Rn=Rn.concat(e);nl();return Rn};a.regions.remove=function(e){var t,r,i;e=e||{};t=rf(e,"duration",k);r=rf(e,"classes",[n.region]);i=If.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]});nl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});nl({withLegend:true});return U};a.x=function(e){if(arguments.length){No(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){Co(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){ls(t,e[t])});Fs()}};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}nl({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}nl({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){gl(Fo(e));nl({withLegend:true})};a.legend.hide=function(e){yl(Fo(e));nl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;a.flush();a.flush()};a.flush=function(){al({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};zf.classed("c3",false).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)}Jf(r)})}else if("rows"in t.data){Jf(Lo(t.data.rows))}else if("columns"in t.data){Jf(Ao(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)
|
|
|