diff --git a/c3.js b/c3.js index e9596fe..c77548a 100644 --- a/c3.js +++ b/c3.js @@ -3489,6 +3489,7 @@ return function (t) { return getArc(interpolate(t), true); }; }) .attr("transform", withTransform ? "scale(1)" : "") + .style("fill", function (d) { return (__color_values) ? levelColor(d.data.values[0].value) : color(d.data.id); }) // Where gauge reading color would receive customization. .style("opacity", (__color_opacity) ? __color_opacity : 1); main.selectAll('.' + CLASS.chartArc).select('text') .attr("transform", transformForArcLabel) diff --git a/c3.min.js b/c3.min.js index 7eb861b..cb9d62e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1 +1 @@ -(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"}var t={version:"0.1.27"};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",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",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",step:"c3-step",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};t.generate=function(t){function f(e,n){if(!(e in t)){throw Error(n)}}function l(e,n){var r=t,i,s,o;for(i=0;i0?s:0}function Pr(){return h?h:qr()}function Hr(){var e=p?p:Rr();return e>0?e:320}function Br(){if(au(u.data.targets)){return 0}else if(d){return d}else{return it||!gt||St?1:Fr("y")}}function jr(){var e=1;if(au(u.data.targets)){return 0}else if(v){return v}else if(br){return Un+(Ct&&!it?Fr("y2"):e)}else if(Ct){return Mt||it?e:Fr("y2")}else{return e}}function Fr(e){var t=xi(e);return t.isInner?20+Ui(e):40+Ui(e)}function Ir(e){if(e==="y"&&!gt){return et&&!br?10:1}if(e==="y2"&&!Ct){return Or}return(xi(e).isInner?30:40)+(e==="y2"?-10:0)}function qr(){return+o.select(c).style("width").replace("px","")}function Rr(){return+o.select(c).style("height").replace("px","")}function Ur(e){return e?-(1+4):-(_n.left-1)}function zr(e){return e?-20:-1}function Wr(){return Ur(!it)}function Xr(){return zr(!it)}function Vr(){return Ur(it)}function $r(){return zr(it)}function Jr(e){return e?Hn+2+4:_n.left+20}function Kr(e){return e?80:jn+2}function Qr(){return Jr(!it)}function Gr(){return Kr(!it)}function Yr(){return Jr(it)}function Zr(){return Kr(it)}function ei(){var e=it?jn:Hn,t=Bs(),n=ls()*(iu(u.data.targets)?(t-(xn?.25:1))/t:.98);return t>1?e*n/(t-1):e}function ti(e){wr=e}function ni(e){Er=e}function ri(e){Sr=e}function ii(){return et?br?Er*(wr+1):In:0}function si(){return et?br?qn:Sr*(wr+1):0}function oi(){var e,t=!ir;Qn=it?1:0;Gn=it?jn:Hn;Yn=it?0:jn;Zn=it?Hn:1;er=Qn;tr=Gn;nr=it?0:Fn;rr=it?Bn:1;ir=ai(Qn,Gn,t?undefined:ir.domain(),function(){return lr.tickOffset()});sr=fi(Yn,Zn);or=fi(Yn,Zn);ur=ai(Qn,Gn,ha,function(e){return e%1?0:pr.tickOffset()});ar=fi(nr,rr);fr=fi(nr,rr);e=vi();lr=hi(ir,dr,e);pr=hi(ur,gr,e);cr=pi(sr,vr,xt,Nt);hr=pi(or,mr,_t,Pt);if(!t){ra.scale(ur);if(m){ia.scale(ir)}}ui()}function ui(){Vn=Vi();$n=$i();Jn=$i(.98)}function ai(e,t,n,r){var u=(Sn?o.time.scale():o.scale.linear()).range([e,t]);u.orgDomain=function(){return u.domain()};if(s(n)){u.domain(n)}if(i(r)){r=function(){return 0}}if(xn){var a=u,f;u=function(e){return a(e)+r(e)};for(f in a){u[f]=a[f]}u.orgDomain=function(){return a.domain()};u.domain=function(e){if(!arguments.length){e=a.domain();return[e[0],e[1]+1]}a.domain(e);return u}}return u}function fi(e,t){return o.scale.linear().range([e,t])}function li(e){return di(e)==="y2"?or:sr}function ci(e){return di(e)==="y2"?fr:ar}function hi(e,t,n){var r=(xn?Wi():o.svg.axis()).scale(e).orient(t);r.tickFormat(n);if(xn){r.tickCentered(ut)}else{r.tickOffset=function(){var e=it?jn:Hn;return e*ls()/Bs()/2}}if(xn){r.categories(ot)}return r}function pi(e,t,n,r){return o.svg.axis().scale(e).orient(t).tickFormat(n).ticks(r).outerTickSize(0)}function di(e){return e in L?L[e]:"y"}function vi(){var e=Sn?On:xn?Gs:function(e){return e<0?e.toFixed(0):e};if(at){if(typeof at==="function"){e=at}else if(Sn){e=function(e){return o.time.format(at)(e)}}}return e}function mi(e){var t;if(e==="y"){t=Et}else if(e==="y2"){t=Ot}else if(e==="x"){t=mt}return t}function gi(e){var t=mi(e);return typeof t==="string"?t:t?t.text:null}function yi(e,t){var n=mi(e);if(typeof n==="string"){if(e==="y"){Et=t}else if(e==="y2"){Ot=t}else if(e==="x"){mt=t}}else if(n){n.text=t}}function bi(e,t){var n=mi(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 wi(){return bi("x",it?"inner-top":"inner-right")}function Ei(){return bi("y",it?"inner-right":"inner-top")}function Si(){return bi("y2",it?"inner-right":"inner-top")}function xi(e){return e==="y2"?Si():e==="y"?Ei():wi()}function Ti(){return gi("x")}function Ni(){return gi("y")}function Ci(){return gi("y2")}function ki(e,t){if(e){return t.isLeft?0:t.isCenter?Hn/2:Hn}else{return t.isBottom?-jn:t.isMiddle?-jn/2:0}}function Li(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 Ai(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Oi(){return ki(!it,wi())}function Mi(){return ki(it,Ei())}function _i(){return ki(it,Si())}function Di(){return Li(!it,wi())}function Pi(){return Li(it,Ei())}function Hi(){return Li(it,Si())}function Bi(){var e=wi();if(it){return e.isInner?"1.2em":-30-Ui("x")}else{return e.isInner?"-0.5em":"3em"}}function ji(){var e=Ei();if(it){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-Ui("y")}}function Fi(){var e=Si();if(it){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+Ui("y2")}}function Ii(){return Ai(!it,wi())}function qi(){return Ai(it,Ei())}function Ri(){return Ai(it,Si())}function Ui(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;o.selectAll("."+r+" .tick text").each(function(){var e=this.getBBox();if(t0&&t[0]>0){t.unshift(t[0]-(t[1]-t[0]))}return t}function m(e,t){var n=e.length-1;return n<=u||t%Math.ceil(n/u)===0}function g(e){return e0){f=Ks(e);for(r=0;r=0});if(u.length===0){continue}s=u[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return o.min(Object.keys(n).map(function(e){return o.min(n[e])}))}function as(e){var t=Fs(e),n=$s(e),r,i,s,u,a,f;if(k.length>0){f=Qs(e);for(r=0;r=0});if(u.length===0){continue}s=u[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?i/(s-1)/2:.5}else if(Ht){o=i*.001}else{o=i*.01}return o}function ds(e){var t=[cs(e),hs(e)],n=t[0],r=t[1],i=ps(e,t),s=n==undefined?i:Sn?new Date(n.getTime()-i):n-i,o=r==undefined?i:Sn?new Date(r.getTime()+i):r+i;return[s,o]}function vs(e){return e[1]-e[0]}function ms(e){for(var t=0;t=0){u.data.x[t]=e.map(function(e){return e[r]})}}else{u.data.x[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!u.data.x[e]){throw new Error('x is not defined for id = "'+e+'".')}});r=t.map(function(t,n){var r=N(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=xs(t),o=e[s],u=As(o,t,i);if(Tn&&xn&&n===0&&o){if(i===0){ot=[]}ot.push(o)}if(typeof e[t]==="undefined"){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"})}});r.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(A){nu(Fs(r).filter(function(e){return!(e in O)}),A)}r.forEach(function(e){gs(e.id_org,e)});return r}function Ds(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 Ps(e){return e>0&&u.data.targets[0].values[e-1]?u.data.targets[0].values[e-1].x:undefined}function Hs(e){return e1){u.data.targets.forEach(function(e){if(e.values.length>t){n=e;t=e.values.length}})}else{n=e?u.data.targets[0]:null}return n}function Fs(e){e=i(e)?u.data.targets:e;return e.map(function(e){return e.id})}function Is(e){var t=Fs(),n;for(n=0;n2){s=n-2;r=e[0];i=e[e.length-1];o=(i-r)/(s+1);t=[r];for(u=0;u0})}function Gs(e){return e=0;n--){if(r!==e[n].x){break}i.push(e[n])}for(n=t;n0?s=o:i=o;if(s-i===1||i===0&&s===0){f=[];if(e[i].x){f=f.concat(Ao(e,i))}if(e[s].x){f=f.concat(Ao(e,s))}return _o(f,t)}return Oo(e,t,i,s)}function Mo(e,t){var n;n=e.map(function(e){return Oo(e.values,t)});return _o(n,t)}function _o(e,t){var n,r;e.forEach(function(e){var i=Lu(e,t);if(il){o-=n+60}if(f+i>Hr()){f-=i+30}}la.style("top",f+"px").style("left",o+"px")}function Fo(){la.style("display","none")}function Io(e){var t=e.filter(function(e){return e&&r(e.value)});if(!fn){return}if(su(u.data.targets)||au(u.data.targets)){return}ua.selectAll("line."+n.xgridFocus).style("visibility","visible").data([t[0]]).attr(it?"y1":"x1",No).attr(it?"y2":"x2",No)}function qo(){ua.select("line."+n.xgridFocus).style("visibility","hidden")}function Ro(e){return e.x||e.x===0?ir(e.x):null}function Uo(e,t){var n=Yo(),r=Zu(n);if(k.length>0){var i=r(e,t);return i[0][1]}return li(e.id)(e.value)}function zo(){var e={},t=0,n,r;Us(qs(pu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function $o(e,t){return Jt?Jt:t?e.tickOffset()*2*Kt/t:0}function Jo(){var e={},t=0,n,r;Us(qs(hu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function Yo(){var e={},t=0,n,r;Us(qs(fu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function nu(e,t){var n=i(e)?Fs():e;if(typeof n==="string"){n=[n]}for(var r=0;r0}function ku(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function Lu(e,t){return Math.pow(ir(e.x)-t[0],2)+Math.pow(sr(e.value)-t[1],2)}function Au(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function Ou(e,t,r){U(t,e.node());ua.select("."+n.selectedCircles+po(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return Ys(n.selectedCircle,r)}).attr("cx",it?Uo:Ro).attr("cy",it?Ro:Uo).attr("stroke",function(){return An(t.id)}).attr("r",$t*1.4).transition().duration(100).attr("r",$t)}function Mu(e,t,r){z(t,e.node());ua.select("."+n.selectedCircles+po(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function _u(e,t,n,r){e?Ou(t,n,r):Mu(t,n,r)}function Du(e,t){U(t,e.node());e.transition().duration(100).style("fill",function(){return o.rgb(An(t.id)).darker(1)})}function Pu(e,t){z(t,e.node());e.transition().duration(100).style("fill",function(){return An(t.id)})}function Hu(e,t,n,r){e?Du(t,n,r):Pu(t,n,r)}function Bu(e){return e.filter(function(e){return r(e.value)})}function ju(e,t){return(t?ua.selectAll("."+n.circles+po(t)):ua).selectAll("."+n.circle+(r(e)?"-"+e:""))}function Fu(e,t){ju(e,t).classed(n.EXPANDED,true).attr("r",Vt)}function Iu(e){ju(e).filter(function(){return o.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",zt)}function qu(e){return ua.selectAll("."+n.bar+(r(e)?"-"+e:""))}function Ru(e){qu(e).classed(n.EXPANDED,true)}function Uu(e){qu(e).classed(n.EXPANDED,false)}function Xu(e,t){var n,r=Gu(e,t);if(it){n=o.svg.area().x0(function(e,t){return li(e.id)(0)}).x1(function(e,t){return li(e.id)(e.value)}).y(No)}else{n=o.svg.area().x(No).y0(function(e,t){if(k.length>0){var n=r(e,t);return n[0][1]}return li(e.id)(0)}).y1(function(e,t){if(k.length>0){var n=r(e,t);return n[1][1]}return li(e.id)(e.value)})}return function(e,t){var r=Bu(e.values),i,s;if(ru([e],"area")||ru([e],"area-spline")){cu(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(ru([e],"area-step")){lu(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=ir(r[0].x);s=li(e.id)(r[0].value);return it?"M "+s+" "+i:"M "+i+" "+s}}}function Vu(e,t){var n=Yu(e,t);return function(e,t){var r=n(e,t);var i=it?1:0;var s=it?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 $u(e,t){var n=Zu(e,t),r=o.svg.line().x(it?function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return li(e.id)(e.value)}:No).y(it?No:function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return li(e.id)(e.value)});return function(e){var t=Bu(e.values),n,i;if(fu(e)){cu(e)?r.interpolate("cardinal"):r.interpolate("linear");return D[e.id]?na(t,ir,li(e.id),D[e.id]):r(t)}else if(lu(e)){r.interpolate("step-after");return D[e.id]?na(t,ir,li(e.id),D[e.id]):r(t)}else{n=ir(t[0].x);i=li(e.id)(t[0].value);return it?"M "+i+" "+n:"M "+n+" "+i}}}function Ju(e,t){var n=Yu(e,false),r=t?Ku:Qu;return function(e,t){return r(n(e,t),e,this)}}function Ku(e,t){var n;if(it){n=pu(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 Qu(e,t,n){var r=n.getBBox();if(it){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:pu(t)?-3:-6)}}function Gu(e,t){var n=e.__max__+1,r=Ko(n,e,!!t),i=Qo(!!t),s=Go(e,!!t),o=t?ci:li;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(it){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function Yu(e,t){var n=e.__max__+1,r=$o(lr,n),i=Wo(r,n,e,!!t),s=Xo(!!t),o=Vo(e,!!t),u=t?ci:li;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(it){if(e.value>0&&la){l=a}}return[[f,a],[f,l-(n-a)],[f+r,l-(n-a)],[f+r,a]]}}function Zu(e,t){var n=e.__max__+1,r=Zo(n,e,!!t),i=eu(!!t),s=tu(e,!!t),o=t?ci:li;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(it){if(e.value>0&&fu){f=u}}return[[a,f-(n-u)]]}}function na(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m;var g,y;var b=[];if(s(r)){for(u=0;u0){s=[];for(var o in C){for(i=0;i=m){m=s}if(!g||o>=g){g=o}l=br?g:m;if(rt){Object.keys(E).forEach(function(e){E[e]=m});Object.keys(S).forEach(function(e){S[e]=g});f=(a-l*r.length)/2;if(f"+(f||f===0?""+f+"":"")}c=e[a].name;l=o(e[a].value,e[a].ratio);u+="";u+=""+c+"";u+=""+l+"";u+=""}return u+""}),pn=l(["tooltip","init","show"],false),dn=l(["tooltip","init","x"],0),vn=l(["tooltip","init","position"],{top:"0px",left:"50px"});var mn=(typeof c==="string"?c.replace("#",""):c.id)+"-clip",gn=mn+"-xaxis",yn=mn+"-yaxis",bn=xr(mn),wn=xr(wn),En=xr(En);var Sn=st==="timeseries",xn=st==="categorized",Tn=!Sn&&(S||Cu(x));var Nn=null,Cn=false,kn=false,Ln=false;var An=Eu(P,Y);var On=function(){var e=[[o.time.format("%Y/%-m/%-d"),function(){return true}],[o.time.format("%-m/%-d"),function(e){return e.getMonth()}],[o.time.format("%-m/%-d"),function(e){return e.getDate()!==1}],[o.time.format("%-m/%-d"),function(e){return e.getDay()&&e.getDate()!==1}],[o.time.format("%I %p"),function(e){return e.getHours()}],[o.time.format("%I:%M"),function(e){return e.getMinutes()}],[o.time.format(":%S"),function(e){return e.getSeconds()}],[o.time.format(".%L"),function(e){return e.getMilliseconds()}]];return function(t){var n=e.length-1,r=e[n];while(!r[1](t)){r=e[--n]}return r[0](t)}}();var Mn=[];var _n,Dn,Pn,Hn,Bn,jn,Fn,In,qn,Rn,Un;var zn,Wn,Xn,Vn,$n,Jn,Kn;var Qn,Gn,Yn,Zn,er,tr,nr,rr;var ir,sr,or,ur,ar,fr,lr,cr,hr,pr;var dr=it?"left":"bottom",vr=it?St?"top":"bottom":St?"right":"left",mr=it?Mt?"bottom":"top":Mt?"left":"right",gr=it?"left":"bottom";var yr={main:function(){return"translate("+_n.left+","+_n.top+")"},context:function(){return"translate("+Dn.left+","+Dn.top+")"},legend:function(){return"translate("+Pn.left+","+Pn.top+")"},x:function(){return"translate(0,"+(it?0:jn)+")"},y:function(){return"translate(0,"+(it?jn:0)+")"},y2:function(){return"translate("+(it?0:Hn)+","+(it?1:0)+")"},subx:function(){return"translate(0,"+(it?0:Fn)+")"},arc:function(){return"translate("+Hn/2+","+jn/2+")"}};var br=tt==="right";var wr=0,Er=0,Sr=0;var Lr=30,Ar=30,Or=5;Kn=o.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var zu=function(){var e=o.svg.line().x(it?function(e){return li(e.id)(e.value)}:No).y(it?No:function(e){return li(e.id)(e.value)});return function(t){var n=Bu(t.values),r,i;if(fu(t)){cu(t)?e.interpolate("cardinal"):e.interpolate("linear");return D[t.id]?na(n,ir,li(t.id),D[t.id]):e(n)}else if(lu(t)){e.interpolate("step-after");return D[t.id]?na(n,ir,li(t.id),D[t.id]):e(n)}else{r=ir(n[0].x);i=li(t.id)(n[0].value);return it?"M "+i+" "+r:"M "+r+" "+i}}}();var Wu=function(){var e;if(it){e=o.svg.area().x0(function(e){return li(e.id)(0)}).x1(function(e){return li(e.id)(e.value)}).y(No)}else{e=o.svg.area().x(No).y0(function(e){return li(e.id)(0)}).y1(function(e){return li(e.id)(e.value)})}return function(t){var n=Bu(t.values),r,i;if(ru([t],"area")||ru([t],"area-spline")){cu(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(ru([t],"area-step")){lu(t)?e.interpolate("step-after"):e.interpolate("linear");return e(n)}else{r=ir(n[0].x);i=li(t.id)(n[0].value);return it?"M "+i+" "+r:"M "+r+" "+i}}}();var ea=function(){var e=o.svg.line().x(it?function(e){return ci(e.id)(e.value)}:Lo).y(it?Lo:function(e){return ci(e.id)(e.value)});return function(t){var n=Bu(t.values);if(fu(t)){return e(n)}else if(lu(t)){e.interpolate("step-after");return e(n)}else{return"M "+ur(n[0].x)+" "+ci(t.id)(n[0].value)}}}();var ta=function(){var e=o.svg.area().x(No).y0(function(e,t){return ci(e.id)(0)}).y1(function(e,t){return ci(e.id)(e.value)});return function(t){var n=Bu(t.values),r,i;if(ru([t],"area")||ru([t],"area-spline")){cu(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(ru([t],"area-step")){lu(t)?e.interpolate("step-after"):e.interpolate("linear");return e(n)}else{r=ur(n[0].x);i=ci(t.id)(n[0].value);return it?"M "+i+" "+r:"M "+r+" "+i}}}();var ra,ia=function(){};ra=o.svg.brush().on("brush",xa);ra.update=function(){if(aa){aa.select("."+n.brush).call(this)}return this};ra.scale=function(e){return it?this.y(e):this.x(e)};if(m){ia=o.behavior.zoom().on("zoomstart",function(){ia.altDomain=o.event.sourceEvent.altKey?ir.orgDomain():null}).on("zoom",m?Ta:null);ia.scale=function(e){return it?this.y(e):this.x(e)};ia.orgScaleExtent=function(){var e=g?g:[1,10];return[e[0],Math.max(Bs()/e[1],e[1])]};ia.updateScaleExtent=function(){var e=vs(ir.orgDomain())/vs(ha),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var sa,oa,ua,aa,fa,la,ca;var ha;var pa,da={};u.focus=function(e){function s(e){Us(e).transition().duration(100).style("opacity",1)}var t=sa.selectAll(vo(e)),r=t.filter(ja),i=t.filter(Fa);u.revert();u.defocus();s(r.classed(n.focused,true));s(i);if(au(u.data.targets)){Zi(e,true)}Da(e)};u.defocus=function(e){function s(e){Us(e).transition().duration(100).style("opacity",.3)}var t=sa.selectAll(vo(e)),r=t.filter(ja),i=t.filter(Fa);u.revert();s(r.classed(n.focused,false));s(i);if(au(u.data.targets)){es(e)}Pa(e)};u.revert=function(e){function s(e){Us(e).transition().duration(100).style("opacity",1)}var t=sa.selectAll(vo(e)),r=t.filter(ja),i=t.filter(Fa);s(r.classed(n.focused,false));s(i);if(au(u.data.targets)){es(e)}Ha()};u.show=function(e){Vs(e);sa.selectAll(vo(e)).transition().style("opacity",1);Sa({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.hide=function(e){Xs(e);sa.selectAll(vo(e)).transition().style("opacity",0);Sa({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.toggle=function(e){Rs(e)?u.hide(e):u.show(e)};u.unzoom=function(){ra.clear().update();Sa({withUpdateXDomain:true})};u.load=function(e){if(e.xs){Ns(e.xs)}if("categories"in e&&xn){ot=e.categories;lr.categories(ot)}if("cacheIds"in e&&ms(e.cacheIds)){Aa(ys(e.cacheIds),e.done);return}if("unload"in e){Ma(typeof e.unload==="string"?[e.unload]:typeof e.unload==="boolean"&&e.unload?Fs():e.unload,function(){Oa(e)})}else{Oa(e)}};u.unload=function(e){Ma(e?typeof e==="string"?[e]:e:Fs(),function(){Sa({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})})};u.selected=function(e){return o.merge(ua.selectAll("."+n.shapes+po(e)).selectAll("."+n.shape).filter(function(){return o.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){return e.__data__})}))};u.select=function(e,t,r){if(!H){return}ua.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,u){var a=o.select(this),f=this.nodeName==="circle"?Ou:Du,l=this.nodeName==="circle"?Mu:Pu,c=B||!e||e.indexOf(i.id)>=0,h=!t||t.indexOf(u)>=0,p=a.classed(n.SELECTED);if(c&&h){if(j(i)&&!p){f(a.classed(n.SELECTED,true),i,u)}}else if(s(r)&&r){if(p){l(a.classed(n.SELECTED,false),i,u)}}})};u.unselect=function(e,t){if(!H){return}ua.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=o.select(this),u=this.nodeName==="circle"?Mu:Pu,a=B||!e||e.indexOf(r.id)>=0,f=!t||t.indexOf(i)>=0,l=s.classed(n.SELECTED);if(a&&f){if(j(r)){if(l){u(s.classed(n.SELECTED,false),r,i)}}}})};u.toLine=function(e){nu(e,"line");ka()};u.toSpline=function(e){nu(e,"spline");ka()};u.toBar=function(e){nu(e,"bar");ka()};u.toScatter=function(e){nu(e,"scatter");ka()};u.toArea=function(e){nu(e,"area");ka()};u.toAreaSpline=function(e){nu(e,"area-spline");ka()};u.toPie=function(e){nu(e,"pie");ka({withTransform:true})};u.toDonut=function(e){nu(e,"donut");ka({withTransform:true})};u.groups=function(e){if(i(e)){return k}k=e;Sa();return k};u.xgrids=function(e){if(!e){return Ft}Ft=e;Sa();return Ft};u.xgrids.add=function(e){if(!e){return}return u.xgrids(Ft.concat(e))};u.xgrids.remove=function(e){var t=Ia(e);return u.xgrids(Ft.filter(t))};u.ygrids=function(e){if(!e){return qt}qt=e;Sa();return qt};u.ygrids.add=function(e){if(!e){return}return u.ygrids(qt.concat(e))};u.ygrids.remove=function(e){var t=Ia(e);return u.ygrids(qt.filter(t))};u.regions=function(e){if(i(e)){return an}an=e;Sa();return an};u.regions.add=function(e){if(i(e)){return an}an=an.concat(e);Sa();return an};u.regions.remove=function(e,t){var n=[].concat(e);t=s(t)?t:{};n.forEach(function(e){var n=r(t.duration)?t.duration:0;sa.selectAll("."+e).transition().duration(n).style("fill-opacity",0).remove();an=an.filter(function(t){return t.classes.indexOf(e)<0})});return an};u.data.get=function(e){var t=u.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};u.data.getAsTarget=function(e){var t=qs(function(t){return t.id===e});return t.length>0?t[0]:undefined};u.data.names=function(e){if(!arguments.length){return C}Object.keys(e).forEach(function(t){C[t]=e[t]});Ba(u.data.targets,{withTransition:true});return C};u.x=function(e){if(arguments.length){ks(u.data.targets,e);Sa({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.xs=function(e){if(arguments.length){Ls(u.data.targets,e);Sa({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){yi(t,e[t])});zi()}};u.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){yt=+e.y}if(r(e.y2)){kt=+e.y2}}else{yt=kt=+e}Sa()}};u.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){bt=+e.y}if(r(e.y2)){Lt=+e.y2}}else{bt=Lt=+e}Sa()}};u.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){u.axis.max(e.max)}if(typeof e.min!=="undefined"){u.axis.min(e.min)}}};u.resize=function(e){h=e?e.width:null;p=e?e.height:null;ka({withLegend:true,withTransition:false})};u.destroy=function(){u.data.targets=undefined;u.data.x={};ca.html("");e.onresize=null};if("url"in t.data){o.csv(t.data.url,function(e,t){va(t)})}else if("rows"in t.data){va(Os(t.data.rows))}else if("columns"in t.data){va(Ms(t.data.columns))}else{throw Error("url or rows or columns is required.")}return u};if(typeof e.define==="function"&&e.define.amd){e.define("c3",["d3"],t)}else{e.c3=t}})(window) +(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"}var t={version:"0.1.27"};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",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",step:"c3-step",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};t.generate=function(t){function f(e,n){if(!(e in t)){throw Error(n)}}function l(e,n){var r=t,i,s,o;for(i=0;i0?s:0}function $r(){return h?h:Zr()}function Jr(){var e=p?p:ei();return e>0?e:320}function Kr(){if(Su(u.data.targets)){return 0}else if(d){return d}else{return st||!yt||xt?1:Gr("y")}}function Qr(){var e=1;if(Su(u.data.targets)){return 0}else if(v){return v}else if(_r){return tr+(kt&&!st?Gr("y2"):e)}else if(kt){return _t||st?e:Gr("y2")}else{return e}}function Gr(e){var t=Bi(e);return t.isInner?20+ts(e):40+ts(e)}function Yr(e){if(e==="y"&&!yt){return tt&&!_r?10:1}if(e==="y2"&&!kt){return zr}return(Bi(e).isInner?30:40)+(e==="y2"?-10:0)}function Zr(){return+o.select(c).style("width").replace("px","")}function ei(){return+o.select(c).style("height").replace("px","")}function ti(e){return e?-(1+4):-(Xn.left-1)}function ni(e){return e?-20:-1}function ri(){return ti(!st)}function ii(){return ni(!st)}function si(){return ti(st)}function oi(){return ni(st)}function ui(e){return e?Jn+2+4:Xn.left+20}function ai(e){return e?80:Qn+2}function fi(){return ui(!st)}function li(){return ai(!st)}function ci(){return ui(st)}function hi(){return ai(st)}function pi(){var e=st?Qn:Jn,t=Ks(),n=xs()*(gu(u.data.targets)?(t-(Hn?.25:1))/t:.98);return t>1?e*n/(t-1):e}function di(e){Dr=e}function vi(e){Pr=e}function mi(e){Hr=e}function gi(){return tt?_r?Pr*(Dr+1):Yn:0}function yi(){return tt?_r?Zn:Hr*(Dr+1):0}function bi(){var e,t=!gr;fr=st?1:0;lr=st?Qn:Jn;cr=st?0:Qn;hr=st?Jn:1;pr=fr;dr=lr;vr=st?0:Gn;mr=st?Kn:1;gr=Ei(fr,lr,t?undefined:gr.domain(),function(){return xr.tickOffset()});yr=Si(cr,hr);br=Si(cr,hr);wr=Ei(fr,lr,La,function(e){return e%1?0:Cr.tickOffset()});Er=Si(vr,mr);Sr=Si(vr,mr);e=Li();xr=Ni(gr,kr,e);Cr=Ni(wr,Or,e);Tr=Ci(yr,Lr,Tt,Ct);Nr=Ci(br,Ar,Dt,Ht);if(!t){ba.scale(wr);if(m){wa.scale(gr)}}wi()}function wi(){sr=ss();or=os();ur=os(.98)}function Ei(e,t,n,r){var u=(Pn?o.time.scale():o.scale.linear()).range([e,t]);u.orgDomain=function(){return u.domain()};if(s(n)){u.domain(n)}if(i(r)){r=function(){return 0}}if(Hn){var a=u,f;u=function(e){return a(e)+r(e)};for(f in a){u[f]=a[f]}u.orgDomain=function(){return a.domain()};u.domain=function(e){if(!arguments.length){e=a.domain();return[e[0],e[1]+1]}a.domain(e);return u}}return u}function Si(e,t){return o.scale.linear().range([e,t])}function xi(e){return ki(e)==="y2"?br:yr}function Ti(e){return ki(e)==="y2"?Sr:Er}function Ni(e,t,n){var r=(Hn?rs():o.svg.axis()).scale(e).orient(t);r.tickFormat(n);if(Hn){r.tickCentered(at)}else{r.tickOffset=function(){var e=st?Qn:Jn;return e*xs()/Ks()/2}}if(Hn){r.categories(ut)}return r}function Ci(e,t,n,r){return o.svg.axis().scale(e).orient(t).tickFormat(n).ticks(r).outerTickSize(0)}function ki(e){return e in L?L[e]:"y"}function Li(){var e=Pn?zn:Hn?lo:function(e){return e<0?e.toFixed(0):e};if(ft){if(typeof ft==="function"){e=ft}else if(Pn){e=function(e){return o.time.format(ft)(e)}}}return e}function Ai(e){var t;if(e==="y"){t=St}else if(e==="y2"){t=Mt}else if(e==="x"){t=gt}return t}function Oi(e){var t=Ai(e);return typeof t==="string"?t:t?t.text:null}function Mi(e,t){var n=Ai(e);if(typeof n==="string"){if(e==="y"){St=t}else if(e==="y2"){Mt=t}else if(e==="x"){gt=t}}else if(n){n.text=t}}function _i(e,t){var n=Ai(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 Di(){return _i("x",st?"inner-top":"inner-right")}function Pi(){return _i("y",st?"inner-right":"inner-top")}function Hi(){return _i("y2",st?"inner-right":"inner-top")}function Bi(e){return e==="y2"?Hi():e==="y"?Pi():Di()}function ji(){return Oi("x")}function Fi(){return Oi("y")}function Ii(){return Oi("y2")}function qi(e,t){if(e){return t.isLeft?0:t.isCenter?Jn/2:Jn}else{return t.isBottom?-Qn:t.isMiddle?-Qn/2:0}}function Ri(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 Ui(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function zi(){return qi(!st,Di())}function Wi(){return qi(st,Pi())}function Xi(){return qi(st,Hi())}function Vi(){return Ri(!st,Di())}function $i(){return Ri(st,Pi())}function Ji(){return Ri(st,Hi())}function Ki(){var e=Di();if(st){return e.isInner?"1.2em":-30-ts("x")}else{return e.isInner?"-0.5em":"3em"}}function Qi(){var e=Pi();if(st){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-ts("y")}}function Gi(){var e=Hi();if(st){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+ts("y2")}}function Yi(){return Ui(!st,Di())}function Zi(){return Ui(st,Pi())}function es(){return Ui(st,Hi())}function ts(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;o.selectAll("."+r+" .tick text").each(function(){var e=this.getBBox();if(t0&&t[0]>0){t.unshift(t[0]-(t[1]-t[0]))}return t}function m(e,t){var n=e.length-1;return n<=u||t%Math.ceil(n/u)===0}function g(e){return e0){f=ao(e);for(r=0;r=0});if(u.length===0){continue}s=u[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return o.min(Object.keys(n).map(function(e){return o.min(n[e])}))}function Es(e){var t=Gs(e),n=oo(e),r,i,s,u,a,f;if(k.length>0){f=fo(e);for(r=0;r=0});if(u.length===0){continue}s=u[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?i/(s-1)/2:.5}else if(Bt){o=i*.001}else{o=i*.01}return o}function ks(e){var t=[Ts(e),Ns(e)],n=t[0],r=t[1],i=Cs(e,t),s=n==undefined?i:Pn?new Date(n.getTime()-i):n-i,o=r==undefined?i:Pn?new Date(r.getTime()+i):r+i;return[s,o]}function Ls(e){return e[1]-e[0]}function As(e){for(var t=0;t=0){u.data.x[t]=e.map(function(e){return e[r]})}}else{u.data.x[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!u.data.x[e]){throw new Error('x is not defined for id = "'+e+'".')}});r=t.map(function(t,n){var r=N(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=Bs(t),o=e[s],u=Us(o,t,i);if(Bn&&Hn&&n===0&&o){if(i===0){ut=[]}ut.push(o)}if(typeof e[t]==="undefined"){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"})}});r.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(A){vu(Gs(r).filter(function(e){return!(e in O)}),A)}r.forEach(function(e){Os(e.id_org,e)});return r}function Vs(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 $s(e){return e>0&&u.data.targets[0].values[e-1]?u.data.targets[0].values[e-1].x:undefined}function Js(e){return e1){u.data.targets.forEach(function(e){if(e.values.length>t){n=e;t=e.values.length}})}else{n=e?u.data.targets[0]:null}return n}function Gs(e){e=i(e)?u.data.targets:e;return e.map(function(e){return e.id})}function Ys(e){var t=Gs(),n;for(n=0;n2){s=n-2;r=e[0];i=e[e.length-1];o=(i-r)/(s+1);t=[r];for(u=0;u0})}function lo(e){return e=0;n--){if(r!==e[n].x){break}i.push(e[n])}for(n=t;n0?s=o:i=o;if(s-i===1||i===0&&s===0){f=[];if(e[i].x){f=f.concat(Uo(e,i))}if(e[s].x){f=f.concat(Uo(e,s))}return Xo(f,t)}return zo(e,t,i,s)}function Wo(e,t){var n;n=e.map(function(e){return zo(e.values,t)});return Xo(n,t)}function Xo(e,t){var n,r;e.forEach(function(e){var i=Wu(e,t);if(il){o-=n+60}if(f+i>Jr()){f-=i+30}}Ca.style("top",f+"px").style("left",o+"px")}function Go(){Ca.style("display","none")}function Yo(e){var t=e.filter(function(e){return e&&r(e.value)});if(!En){return}if(yu(u.data.targets)||Su(u.data.targets)){return}xa.selectAll("line."+n.xgridFocus).style("visibility","visible").data([t[0]]).attr(st?"y1":"x1",Fo).attr(st?"y2":"x2",Fo)}function Zo(){xa.select("line."+n.xgridFocus).style("visibility","hidden")}function eu(e){return e.x||e.x===0?gr(e.x):null}function tu(e,t){var n=cu(),r=va(n);if(k.length>0){var i=r(e,t);return i[0][1]}return xi(e.id)(e.value)}function nu(){var e={},t=0,n,r;to(Zs(ku)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ou(e,t){return Kt?Kt:t?e.tickOffset()*2*Qt/t:0}function uu(){var e={},t=0,n,r;to(Zs(Cu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function cu(){var e={},t=0,n,r;to(Zs(xu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function vu(e,t){var n=i(e)?Gs():e;if(typeof n==="string"){n=[n]}for(var r=0;r0}function zu(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function Wu(e,t){return Math.pow(gr(e.x)-t[0],2)+Math.pow(yr(e.value)-t[1],2)}function Xu(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function Vu(e,t,r){U(t,e.node());xa.select("."+n.selectedCircles+ko(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return co(n.selectedCircle,r)}).attr("cx",st?tu:eu).attr("cy",st?eu:tu).attr("stroke",function(){return Rn(t.id)}).attr("r",Jt*1.4).transition().duration(100).attr("r",Jt)}function $u(e,t,r){z(t,e.node());xa.select("."+n.selectedCircles+ko(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function Ju(e,t,n,r){e?Vu(t,n,r):$u(t,n,r)}function Ku(e,t){U(t,e.node());e.transition().duration(100).style("fill",function(){return o.rgb(Rn(t.id)).darker(1)})}function Qu(e,t){z(t,e.node());e.transition().duration(100).style("fill",function(){return Rn(t.id)})}function Gu(e,t,n,r){e?Ku(t,n,r):Qu(t,n,r)}function Yu(e){return e.filter(function(e){return r(e.value)})}function Zu(e,t){return(t?xa.selectAll("."+n.circles+ko(t)):xa).selectAll("."+n.circle+(r(e)?"-"+e:""))}function ea(e,t){Zu(e,t).classed(n.EXPANDED,true).attr("r",$t)}function ta(e){Zu(e).filter(function(){return o.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",Wt)}function na(e){return xa.selectAll("."+n.bar+(r(e)?"-"+e:""))}function ra(e){na(e).classed(n.EXPANDED,true)}function ia(e){na(e).classed(n.EXPANDED,false)}function ua(e,t){var n,r=pa(e,t);if(st){n=o.svg.area().x0(function(e,t){return xi(e.id)(0)}).x1(function(e,t){return xi(e.id)(e.value)}).y(Fo)}else{n=o.svg.area().x(Fo).y0(function(e,t){if(k.length>0){var n=r(e,t);return n[0][1]}return xi(e.id)(0)}).y1(function(e,t){if(k.length>0){var n=r(e,t);return n[1][1]}return xi(e.id)(e.value)})}return function(e,t){var r=Yu(e.values),i,s;if(mu([e],"area")||mu([e],"area-spline")){Nu(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(mu([e],"area-step")){Tu(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=gr(r[0].x);s=xi(e.id)(r[0].value);return st?"M "+s+" "+i:"M "+i+" "+s}}}function aa(e,t){var n=da(e,t);return function(e,t){var r=n(e,t);var i=st?1:0;var s=st?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 fa(e,t){var n=va(e,t),r=o.svg.line().x(st?function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return xi(e.id)(e.value)}:Fo).y(st?Fo:function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return xi(e.id)(e.value)});return function(e){var t=Yu(e.values),n,i;if(xu(e)){Nu(e)?r.interpolate("cardinal"):r.interpolate("linear");return D[e.id]?ya(t,gr,xi(e.id),D[e.id]):r(t)}else if(Tu(e)){r.interpolate("step-after");return D[e.id]?ya(t,gr,xi(e.id),D[e.id]):r(t)}else{n=gr(t[0].x);i=xi(e.id)(t[0].value);return st?"M "+i+" "+n:"M "+n+" "+i}}}function la(e,t){var n=da(e,false),r=t?ca:ha;return function(e,t){return r(n(e,t),e,this)}}function ca(e,t){var n;if(st){n=ku(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 ha(e,t,n){var r=n.getBBox();if(st){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:ku(t)?-3:-6)}}function pa(e,t){var n=e.__max__+1,r=au(n,e,!!t),i=fu(!!t),s=lu(e,!!t),o=t?Ti:xi;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(st){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function da(e,t){var n=e.__max__+1,r=ou(xr,n),i=ru(r,n,e,!!t),s=iu(!!t),o=su(e,!!t),u=t?Ti:xi;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(st){if(e.value>0&&la){l=a}}return[[f,a],[f,l-(n-a)],[f+r,l-(n-a)],[f+r,a]]}}function va(e,t){var n=e.__max__+1,r=hu(n,e,!!t),i=pu(!!t),s=du(e,!!t),o=t?Ti:xi;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(st){if(e.value>0&&fu){f=u}}return[[a,f-(n-u)]]}}function ya(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m;var g,y;var b=[];if(s(r)){for(u=0;u0){s=[];for(var o in C){for(i=0;i=m){m=s}if(!g||o>=g){g=o}l=_r?g:m;if(it){Object.keys(E).forEach(function(e){E[e]=m});Object.keys(S).forEach(function(e){S[e]=g});f=(a-l*r.length)/2;if(f"+(f||f===0?""+f+"":"")}c=e[a].name;l=o(e[a].value,e[a].ratio);h=et?Un(e[a].value):i(e[a].id);u+="";u+=""+c+"";u+=""+l+"";u+=""}return u+""}),Nn=l(["tooltip","init","show"],false),Cn=l(["tooltip","init","x"],0),kn=l(["tooltip","init","position"],{top:"0px",left:"50px"});var Ln=(typeof c==="string"?c.replace("#",""):c.id)+"-clip",An=Ln+"-xaxis",On=Ln+"-yaxis",Mn=Br(Ln),_n=Br(_n),Dn=Br(Dn);var Pn=ot==="timeseries",Hn=ot==="categorized",Bn=!Pn&&(S||Uu(x));var jn=null,Fn=false,In=false,qn=false;var Rn=Bu(P,Y);var Un=ju(Y,et);var zn=function(){var e=[[o.time.format("%Y/%-m/%-d"),function(){return true}],[o.time.format("%-m/%-d"),function(e){return e.getMonth()}],[o.time.format("%-m/%-d"),function(e){return e.getDate()!==1}],[o.time.format("%-m/%-d"),function(e){return e.getDay()&&e.getDate()!==1}],[o.time.format("%I %p"),function(e){return e.getHours()}],[o.time.format("%I:%M"),function(e){return e.getMinutes()}],[o.time.format(":%S"),function(e){return e.getSeconds()}],[o.time.format(".%L"),function(e){return e.getMilliseconds()}]];return function(t){var n=e.length-1,r=e[n];while(!r[1](t)){r=e[--n]}return r[0](t)}}();var Wn=[];var Xn,Vn,$n,Jn,Kn,Qn,Gn,Yn,Zn,er,tr;var nr,rr,ir,sr,or,ur,ar;var fr,lr,cr,hr,pr,dr,vr,mr;var gr,yr,br,wr,Er,Sr,xr,Tr,Nr,Cr;var kr=st?"left":"bottom",Lr=st?xt?"top":"bottom":xt?"right":"left",Ar=st?_t?"bottom":"top":_t?"left":"right",Or=st?"left":"bottom";var Mr={main:function(){return"translate("+Xn.left+","+Xn.top+")"},context:function(){return"translate("+Vn.left+","+Vn.top+")"},legend:function(){return"translate("+$n.left+","+$n.top+")"},x:function(){return"translate(0,"+(st?0:Qn)+")"},y:function(){return"translate(0,"+(st?Qn:0)+")"},y2:function(){return"translate("+(st?0:Jn)+","+(st?1:0)+")"},subx:function(){return"translate(0,"+(st?0:Gn)+")"},arc:function(){return"translate("+Jn/2+","+Qn/2+")"}};var _r=nt==="right";var Dr=0,Pr=0,Hr=0;var Rr=30,Ur=30,zr=5;ar=o.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var sa=function(){var e=o.svg.line().x(st?function(e){return xi(e.id)(e.value)}:Fo).y(st?Fo:function(e){return xi(e.id)(e.value)});return function(t){var n=Yu(t.values),r,i;if(xu(t)){Nu(t)?e.interpolate("cardinal"):e.interpolate("linear");return D[t.id]?ya(n,gr,xi(t.id),D[t.id]):e(n)}else if(Tu(t)){e.interpolate("step-after");return D[t.id]?ya(n,gr,xi(t.id),D[t.id]):e(n)}else{r=gr(n[0].x);i=xi(t.id)(n[0].value);return st?"M "+i+" "+r:"M "+r+" "+i}}}();var oa=function(){var e;if(st){e=o.svg.area().x0(function(e){return xi(e.id)(0)}).x1(function(e){return xi(e.id)(e.value)}).y(Fo)}else{e=o.svg.area().x(Fo).y0(function(e){return xi(e.id)(0)}).y1(function(e){return xi(e.id)(e.value)})}return function(t){var n=Yu(t.values),r,i;if(mu([t],"area")||mu([t],"area-spline")){Nu(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(mu([t],"area-step")){Tu(t)?e.interpolate("step-after"):e.interpolate("linear");return e(n)}else{r=gr(n[0].x);i=xi(t.id)(n[0].value);return st?"M "+i+" "+r:"M "+r+" "+i}}}();var ma=function(){var e=o.svg.line().x(st?function(e){return Ti(e.id)(e.value)}:Ro).y(st?Ro:function(e){return Ti(e.id)(e.value)});return function(t){var n=Yu(t.values);if(xu(t)){return e(n)}else if(Tu(t)){e.interpolate("step-after");return e(n)}else{return"M "+wr(n[0].x)+" "+Ti(t.id)(n[0].value)}}}();var ga=function(){var e=o.svg.area().x(Fo).y0(function(e,t){return Ti(e.id)(0)}).y1(function(e,t){return Ti(e.id)(e.value)});return function(t){var n=Yu(t.values),r,i;if(mu([t],"area")||mu([t],"area-spline")){Nu(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(mu([t],"area-step")){Tu(t)?e.interpolate("step-after"):e.interpolate("linear");return e(n)}else{r=wr(n[0].x);i=Ti(t.id)(n[0].value);return st?"M "+i+" "+r:"M "+r+" "+i}}}();var ba,wa=function(){};ba=o.svg.brush().on("brush",Ia);ba.update=function(){if(Ta){Ta.select("."+n.brush).call(this)}return this};ba.scale=function(e){return st?this.y(e):this.x(e)};if(m){wa=o.behavior.zoom().on("zoomstart",function(){wa.altDomain=o.event.sourceEvent.altKey?gr.orgDomain():null}).on("zoom",m?qa:null);wa.scale=function(e){return st?this.y(e):this.x(e)};wa.orgScaleExtent=function(){var e=g?g:[1,10];return[e[0],Math.max(Ks()/e[1],e[1])]};wa.updateScaleExtent=function(){var e=Ls(gr.orgDomain())/Ls(La),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var Ea,Sa,xa,Ta,Na,Ca,ka;var La;var Aa,Oa={};u.focus=function(e){function s(e){to(e).transition().duration(100).style("opacity",1)}var t=Ea.selectAll(Lo(e)),r=t.filter(Za),i=t.filter(ef);u.revert();u.defocus();s(r.classed(n.focused,true));s(i);if(Su(u.data.targets)){hs(e,true)}Ka(e)};u.defocus=function(e){function s(e){to(e).transition().duration(100).style("opacity",.3)}var t=Ea.selectAll(Lo(e)),r=t.filter(Za),i=t.filter(ef);u.revert();s(r.classed(n.focused,false));s(i);if(Su(u.data.targets)){ps(e)}Qa(e)};u.revert=function(e){function s(e){to(e).transition().duration(100).style("opacity",1)}var t=Ea.selectAll(Lo(e)),r=t.filter(Za),i=t.filter(ef);s(r.classed(n.focused,false));s(i);if(Su(u.data.targets)){ps(e)}Ga()};u.show=function(e){so(e);Ea.selectAll(Lo(e)).transition().style("opacity",1);Fa({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.hide=function(e){io(e);Ea.selectAll(Lo(e)).transition().style("opacity",0);Fa({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.toggle=function(e){eo(e)?u.hide(e):u.show(e)};u.unzoom=function(){ba.clear().update();Fa({withUpdateXDomain:true})};u.load=function(e){if(e.xs){Fs(e.xs)}if("categories"in e&&Hn){ut=e.categories;xr.categories(ut)}if("cacheIds"in e&&As(e.cacheIds)){Xa(Ms(e.cacheIds),e.done);return}if("unload"in e){$a(typeof e.unload==="string"?[e.unload]:typeof e.unload==="boolean"&&e.unload?Gs():e.unload,function(){Va(e)})}else{Va(e)}};u.unload=function(e){$a(e?typeof e==="string"?[e]:e:Gs(),function(){Fa({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})})};u.selected=function(e){return o.merge(xa.selectAll("."+n.shapes+ko(e)).selectAll("."+n.shape).filter(function(){return o.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){return e.__data__})}))};u.select=function(e,t,r){if(!H){return}xa.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,u){var a=o.select(this),f=this.nodeName==="circle"?Vu:Ku,l=this.nodeName==="circle"?$u:Qu,c=B||!e||e.indexOf(i.id)>=0,h=!t||t.indexOf(u)>=0,p=a.classed(n.SELECTED);if(c&&h){if(j(i)&&!p){f(a.classed(n.SELECTED,true),i,u)}}else if(s(r)&&r){if(p){l(a.classed(n.SELECTED,false),i,u)}}})};u.unselect=function(e,t){if(!H){return}xa.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=o.select(this),u=this.nodeName==="circle"?$u:Qu,a=B||!e||e.indexOf(r.id)>=0,f=!t||t.indexOf(i)>=0,l=s.classed(n.SELECTED);if(a&&f){if(j(r)){if(l){u(s.classed(n.SELECTED,false),r,i)}}}})};u.toLine=function(e){vu(e,"line");za()};u.toSpline=function(e){vu(e,"spline");za()};u.toBar=function(e){vu(e,"bar");za()};u.toScatter=function(e){vu(e,"scatter");za()};u.toArea=function(e){vu(e,"area");za()};u.toAreaSpline=function(e){vu(e,"area-spline");za()};u.toPie=function(e){vu(e,"pie");za({withTransform:true})};u.toDonut=function(e){vu(e,"donut");za({withTransform:true})};u.groups=function(e){if(i(e)){return k}k=e;Fa();return k};u.xgrids=function(e){if(!e){return It}It=e;Fa();return It};u.xgrids.add=function(e){if(!e){return}return u.xgrids(It.concat(e))};u.xgrids.remove=function(e){var t=tf(e);return u.xgrids(It.filter(t))};u.ygrids=function(e){if(!e){return Rt}Rt=e;Fa();return Rt};u.ygrids.add=function(e){if(!e){return}return u.ygrids(Rt.concat(e))};u.ygrids.remove=function(e){var t=tf(e);return u.ygrids(Rt.filter(t))};u.regions=function(e){if(i(e)){return wn}wn=e;Fa();return wn};u.regions.add=function(e){if(i(e)){return wn}wn=wn.concat(e);Fa();return wn};u.regions.remove=function(e,t){var n=[].concat(e);t=s(t)?t:{};n.forEach(function(e){var n=r(t.duration)?t.duration:0;Ea.selectAll("."+e).transition().duration(n).style("fill-opacity",0).remove();wn=wn.filter(function(t){return t.classes.indexOf(e)<0})});return wn};u.data.get=function(e){var t=u.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};u.data.getAsTarget=function(e){var t=Zs(function(t){return t.id===e});return t.length>0?t[0]:undefined};u.data.names=function(e){if(!arguments.length){return C}Object.keys(e).forEach(function(t){C[t]=e[t]});Ya(u.data.targets,{withTransition:true});return C};u.x=function(e){if(arguments.length){qs(u.data.targets,e);Fa({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.xs=function(e){if(arguments.length){Rs(u.data.targets,e);Fa({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){Mi(t,e[t])});ns()}};u.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){bt=+e.y}if(r(e.y2)){Lt=+e.y2}}else{bt=Lt=+e}Fa()}};u.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){wt=+e.y}if(r(e.y2)){At=+e.y2}}else{wt=At=+e}Fa()}};u.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){u.axis.max(e.max)}if(typeof e.min!=="undefined"){u.axis.min(e.min)}}};u.resize=function(e){h=e?e.width:null;p=e?e.height:null;za({withLegend:true,withTransition:false})};u.destroy=function(){u.data.targets=undefined;u.data.x={};ka.html("");e.onresize=null};if("url"in t.data){o.csv(t.data.url,function(e,t){Ma(t)})}else if("rows"in t.data){Ma(zs(t.data.rows))}else if("columns"in t.data){Ma(Ws(t.data.columns))}else{throw Error("url or rows or columns is required.")}return u};if(typeof e.define==="function"&&e.define.amd){e.define("c3",["d3"],t)}else{e.c3=t}})(window)