From 1f6b7983db55f341b83546f52497e3dc50fc0d74 Mon Sep 17 00:00:00 2001 From: Brandon Bernal Date: Fri, 11 Apr 2014 17:56:06 -0400 Subject: [PATCH] MAP-5714: Modified c3 to accept color.opacity as an value in pie charts. --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 0c77b91..14d9df4 100644 --- a/c3.js +++ b/c3.js @@ -1053,7 +1053,7 @@ .transition().duration(50) .attr("d", svgArc); svg.selectAll('.' + CLASS.arc) - .style("opacity", 1); + .style("opacity", (__color_opacity) ? __color_opacity : 1); } function shouldShowArcLable() { return hasDonutType(c3.data.targets) ? __donut_label_show : __pie_label_show; @@ -3362,7 +3362,7 @@ return function (t) { return getArc(interpolate(t), true); }; }) .attr("transform", withTransform ? "scale(1)" : "") - .style("opacity", 1); + .style("opacity", (__color_opacity) ? __color_opacity : 1); main.selectAll('.' + CLASS.chartArc).select('text') .attr("transform", transformForArcLabel) .style("opacity", 0) diff --git a/c3.min.js b/c3.min.js index 6de07fb..c6fdf55 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 Or(){return h?h:Br()}function Mr(){var e=p?p:jr();return e>0?e:320}function _r(){if(iu(u.data.targets)){return 0}else if(d){return d}else{return et||!pt||yt?1:Pr("y")}}function Dr(){var e=1;if(iu(u.data.targets)){return 0}else if(v){return v}else if(vr){return Fn+(St&&!et?Pr("y2"):e)}else if(St){return kt||et?e:Pr("y2")}else{return e}}function Pr(e){var t=bi(e);return t.isInner?20+Fi(e):40+Fi(e)}function Hr(e){if(e==="y"&&!pt){return Q&&!vr?10:1}if(e==="y2"&&!St){return Cr}return(bi(e).isInner?30:40)+(e==="y2"?-10:0)}function Br(){return+o.select(c).style("width").replace("px","")}function jr(){return+o.select(c).style("height").replace("px","")}function Fr(e){return e?-(1+4):-(Ln.left-1)}function Ir(e){return e?-20:-1}function qr(){return Fr(!et)}function Rr(){return Ir(!et)}function Ur(){return Fr(et)}function zr(){return Ir(et)}function Wr(e){return e?Mn+2+4:Ln.left+20}function Xr(e){return e?80:Dn+2}function Vr(){return Wr(!et)}function $r(){return Xr(!et)}function Jr(){return Wr(et)}function Kr(){return Xr(et)}function Qr(){var e=et?Dn:Mn,t=_s(),n=os()*(eu(u.data.targets)?(t-(bn?.25:1))/t:.98);return t>1?e*n/(t-1):e}function Gr(e){mr=e}function Yr(e){gr=e}function Zr(e){yr=e}function ei(){return Q?vr?gr*(mr+1):Hn:0}function ti(){return Q?vr?Bn:yr*(mr+1):0}function ni(){var e,t=!er;Vn=et?1:0;$n=et?Dn:Mn;Jn=et?0:Dn;Kn=et?Mn:1;Qn=Vn;Gn=$n;Yn=et?0:Pn;Zn=et?_n:1;er=ii(Vn,$n,t?undefined:er.domain(),function(){return or.tickOffset()});tr=si(Jn,Kn);nr=si(Jn,Kn);rr=ii(Vn,$n,ua,function(e){return e%1?0:fr.tickOffset()});ir=si(Yn,Zn);sr=si(Yn,Zn);e=ci();or=ai(er,lr,e);fr=ai(rr,pr,e);ur=fi(tr,cr,bt,Et);ar=fi(nr,hr,Lt,Ot);if(!t){Yu.scale(rr);if(m){Zu.scale(er)}}ri()}function ri(){Un=Ui();zn=zi();Wn=zi(.98)}function ii(e,t,n,r){var u=(yn?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(bn){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 oi(e){return li(e)==="y2"?nr:tr}function ui(e){return li(e)==="y2"?sr:ir}function ai(e,t,n){var r=(bn?qi():o.svg.axis()).scale(e).orient(t);r.tickFormat(n);if(bn){r.tickCentered(rt)}else{r.tickOffset=function(){var e=et?Dn:Mn;return e*os()/_s()/2}}if(bn){r.categories(nt)}return r}function fi(e,t,n,r){return o.svg.axis().scale(e).orient(t).tickFormat(n).ticks(r).outerTickSize(0)}function li(e){return e in L?L[e]:"y"}function ci(){var e=yn?Cn:bn?$s:function(e){return e<0?e.toFixed(0):e};if(it){if(typeof it==="function"){e=it}else if(yn){e=function(e){return o.time.format(it)(e)}}}return e}function hi(e){var t;if(e==="y"){t=gt}else if(e==="y2"){t=Ct}else if(e==="x"){t=ht}return t}function pi(e){var t=hi(e);return typeof t==="string"?t:t?t.text:null}function di(e,t){var n=hi(e);if(typeof n==="string"){if(e==="y"){gt=t}else if(e==="y2"){Ct=t}else if(e==="x"){ht=t}}else if(n){n.text=t}}function vi(e,t){var n=hi(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 mi(){return vi("x",et?"inner-top":"inner-right")}function gi(){return vi("y",et?"inner-right":"inner-top")}function yi(){return vi("y2",et?"inner-right":"inner-top")}function bi(e){return e==="y2"?yi():e==="y"?gi():mi()}function wi(){return pi("x")}function Ei(){return pi("y")}function Si(){return pi("y2")}function xi(e,t){if(e){return t.isLeft?0:t.isCenter?Mn/2:Mn}else{return t.isBottom?-Dn:t.isMiddle?-Dn/2:0}}function Ti(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 Ni(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ci(){return xi(!et,mi())}function ki(){return xi(et,gi())}function Li(){return xi(et,yi())}function Ai(){return Ti(!et,mi())}function Oi(){return Ti(et,gi())}function Mi(){return Ti(et,yi())}function _i(){var e=mi();if(et){return e.isInner?"1.2em":-30-Fi("x")}else{return e.isInner?"-0.5em":"3em"}}function Di(){var e=gi();if(et){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-Fi("y")}}function Pi(){var e=yi();if(et){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+Fi("y2")}}function Hi(){return Ni(!et,mi())}function Bi(){return Ni(et,gi())}function ji(){return Ni(et,yi())}function Fi(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=Xs(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 is(e){var t=Ps(e),n=zs(e),r,i,s,u,a,f;if(k.length>0){f=Vs(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(Mt){o=i*.001}else{o=i*.01}return o}function ls(e){var t=[us(e),as(e)],n=t[0],r=t[1],i=fs(e,t),s=yn?new Date(n.getTime()-i):n-i,o=yn?new Date(r.getTime()+i):r+i;return[s,o]}function cs(e){return e[1]-e[0]}function hs(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=Ns(o,t,i);if(wn&&bn&&n===0&&o){if(i===0){nt=[]}nt.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){Yo(Ps(r).filter(function(e){return!(e in O)}),A)}r.forEach(function(e){ps(e.id_org,e)});return r}function As(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 Os(e){return e>0&&u.data.targets[0].values[e-1]?u.data.targets[0].values[e-1].x:undefined}function Ms(e){return e<_s()-1?u.data.targets[0].values[e+1].x:undefined}function _s(){return o.max(u.data.targets,function(e){return e.values.length})}function Ds(){var e=u.data.targets.length,t=0,n;if(e>1){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 Ps(e){e=i(e)?u.data.targets:e;return e.map(function(e){return e.id})}function Hs(e){var t=Ps(),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 $s(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(No(e,i))}if(e[s].x){f=f.concat(No(e,s))}return Lo(f,t)}return Co(e,t,i,s)}function ko(e,t){var n;n=e.map(function(e){return Co(e.values,t)});return Lo(n,t)}function Lo(e,t){var n,r;e.forEach(function(e){var i=Tu(e,t);if(il){o-=n+60}if(f+i>Mr()){f-=i+30}}sa.style("top",f+"px").style("left",o+"px")}function Po(){sa.style("display","none")}function Ho(e){var t=e.filter(function(e){return e&&r(e.value)});if(!sn){return}if(tu(u.data.targets)||iu(u.data.targets)){return}na.selectAll("line."+n.xgridFocus).style("visibility","visible").data([t[0]]).attr(et?"y1":"x1",Eo).attr(et?"y2":"x2",Eo)}function Bo(){na.select("line."+n.xgridFocus).style("visibility","hidden")}function jo(e){return e.x||e.x===0?er(e.x):null}function Fo(e,t){var n=Jo(),r=Ku(n);if(k.length>0){var i=r(e,t);return i[0][1]}return oi(e.id)(e.value)}function Io(){var e={},t=0,n,r;Fs(Bs(fu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function zo(e,t){return Wt?Wt:t?e.tickOffset()*2*Xt/t:0}function Wo(){var e={},t=0,n,r;Fs(Bs(au)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function Jo(){var e={},t=0,n,r;Fs(Bs(su)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function Yo(e,t){var n=i(e)?Ps():e;if(typeof n==="string"){n=[n]}for(var r=0;r0}function xu(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function Tu(e,t){return Math.pow(er(e.x)-t[0],2)+Math.pow(tr(e.value)-t[1],2)}function Nu(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function Cu(e,t,r){U(t,e.node());na.select("."+n.selectedCircles+fo(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return Js(n.selectedCircle,r)}).attr("cx",et?Fo:jo).attr("cy",et?jo:Fo).attr("stroke",function(){return Nn(t.id)}).attr("r",zt*1.4).transition().duration(100).attr("r",zt)}function ku(e,t,r){z(t,e.node());na.select("."+n.selectedCircles+fo(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function Lu(e,t,n,r){e?Cu(t,n,r):ku(t,n,r)}function Au(e,t){U(t,e.node());e.transition().duration(100).style("fill",function(){return o.rgb(Nn(t.id)).darker(1)})}function Ou(e,t){z(t,e.node());e.transition().duration(100).style("fill",function(){return Nn(t.id)})}function Mu(e,t,n,r){e?Au(t,n,r):Ou(t,n,r)}function _u(e){return e.filter(function(e){return r(e.value)})}function Du(e,t){return(t?na.selectAll("."+n.circles+fo(t)):na).selectAll("."+n.circle+(r(e)?"-"+e:""))}function Pu(e,t){Du(e,t).classed(n.EXPANDED,true).attr("r",Ut)}function Hu(e){Du(e).filter(function(){return o.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",It)}function Bu(e){return na.selectAll("."+n.bar+(r(e)?"-"+e:""))}function ju(e){Bu(e).classed(n.EXPANDED,true)}function Fu(e){Bu(e).classed(n.EXPANDED,false)}function Ru(e,t){var n,r=$u(e,t);if(et){n=o.svg.area().x0(function(e,t){return oi(e.id)(0)}).x1(function(e,t){return oi(e.id)(e.value)}).y(Eo)}else{n=o.svg.area().x(Eo).y0(function(e,t){if(k.length>0){var n=r(e,t);return n[0][1]}return oi(e.id)(0)}).y1(function(e,t){if(k.length>0){var n=r(e,t);return n[1][1]}return oi(e.id)(e.value)})}return function(e,t){var r=_u(e.values),i,s;if(Zo([e],"area")||Zo([e],"area-spline")){uu(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(Zo([e],"area-step")){ou(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=er(r[0].x);s=oi(e.id)(r[0].value);return et?"M "+s+" "+i:"M "+i+" "+s}}}function Uu(e,t){var n=Ju(e,t);return function(e,t){var r=n(e,t);var i=et?1:0;var s=et?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 zu(e,t){var n=Ku(e,t),r=o.svg.line().x(et?function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return oi(e.id)(e.value)}:Eo).y(et?Eo:function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return oi(e.id)(e.value)});return function(e){var t=_u(e.values),n,i;if(su(e)){uu(e)?r.interpolate("cardinal"):r.interpolate("linear");return D[e.id]?Gu(t,er,oi(e.id),D[e.id]):r(t)}else if(ou(e)){r.interpolate("step-after");return D[e.id]?Gu(t,er,oi(e.id),D[e.id]):r(t)}else{n=er(t[0].x);i=oi(e.id)(t[0].value);return et?"M "+i+" "+n:"M "+n+" "+i}}}function Wu(e,t){var n=Ju(e,false),r=t?Xu:Vu;return function(e,t){return r(n(e,t),e,this)}}function Xu(e,t){var n;if(et){n=fu(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 Vu(e,t,n){var r=n.getBBox();if(et){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:fu(t)?-3:-6)}}function $u(e,t){var n=e.__max__+1,r=Xo(n,e,!!t),i=Vo(!!t),s=$o(e,!!t),o=t?ui:oi;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(et){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function Ju(e,t){var n=e.__max__+1,r=zo(or,n),i=qo(r,n,e,!!t),s=Ro(!!t),o=Uo(e,!!t),u=t?ui:oi;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(et){if(e.value>0&&la){l=a}}return[[f,a],[f,l-(n-a)],[f+r,l-(n-a)],[f+r,a]]}}function Ku(e,t){var n=e.__max__+1,r=Ko(n,e,!!t),i=Qo(!!t),s=Go(e,!!t),o=t?ui:oi;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(et){if(e.value>0&&fu){f=u}}return[[a,f-(n-u)]]}}function Gu(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=vr?g:m;if(Z){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+""}),fn=l(["tooltip","init","show"],false),ln=l(["tooltip","init","x"],0),cn=l(["tooltip","init","position"],{top:"0px",left:"50px"});var hn=(typeof c==="string"?c.replace("#",""):c.id)+"-clip",pn=hn+"-xaxis",dn=hn+"-yaxis",vn=br(hn),mn=br(mn),gn=br(gn);var yn=tt==="timeseries",bn=tt==="categorized",wn=!yn&&(S||Su(x));var En=null,Sn=false,xn=false,Tn=false;var Nn=gu(P,J);var Cn=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 kn=[];var Ln,An,On,Mn,_n,Dn,Pn,Hn,Bn,jn,Fn;var In,qn,Rn,Un,zn,Wn,Xn;var Vn,$n,Jn,Kn,Qn,Gn,Yn,Zn;var er,tr,nr,rr,ir,sr,or,ur,ar,fr;var lr=et?"left":"bottom",cr=et?yt?"top":"bottom":yt?"right":"left",hr=et?kt?"bottom":"top":kt?"left":"right",pr=et?"left":"bottom";var dr={main:function(){return"translate("+Ln.left+","+Ln.top+")"},context:function(){return"translate("+An.left+","+An.top+")"},legend:function(){return"translate("+On.left+","+On.top+")"},x:function(){return"translate(0,"+(et?0:Dn)+")"},y:function(){return"translate(0,"+(et?Dn:0)+")"},y2:function(){return"translate("+(et?0:Mn)+","+(et?1:0)+")"},subx:function(){return"translate(0,"+(et?0:Pn)+")"},arc:function(){return"translate("+Mn/2+","+Dn/2+")"}};var vr=G==="right";var mr=0,gr=0,yr=0;var Tr=30,Nr=30,Cr=5;Xn=o.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Iu=function(){var e=o.svg.line().x(et?function(e){return oi(e.id)(e.value)}:Eo).y(et?Eo:function(e){return oi(e.id)(e.value)});return function(t){var n=_u(t.values),r,i;if(su(t)){uu(t)?e.interpolate("cardinal"):e.interpolate("linear");return D[t.id]?Gu(n,er,oi(t.id),D[t.id]):e(n)}else if(ou(t)){e.interpolate("step-after");return D[t.id]?Gu(n,er,oi(t.id),D[t.id]):e(n)}else{r=er(n[0].x);i=oi(t.id)(n[0].value);return et?"M "+i+" "+r:"M "+r+" "+i}}}();var qu=function(){var e;if(et){e=o.svg.area().x0(function(e){return oi(e.id)(0)}).x1(function(e){return oi(e.id)(e.value)}).y(Eo)}else{e=o.svg.area().x(Eo).y0(function(e){return oi(e.id)(0)}).y1(function(e){return oi(e.id)(e.value)})}return function(t){var n=_u(t.values),r,i;if(Zo([t],"area")||Zo([t],"area-spline")){uu(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(Zo([t],"area-step")){ou(t)?e.interpolate("step-after"):"";return e(n)}else{r=er(n[0].x);i=oi(t.id)(n[0].value);return et?"M "+i+" "+r:"M "+r+" "+i}}}();var Qu=function(){var e=o.svg.line().x(et?function(e){return ui(e.id)(e.value)}:To).y(et?To:function(e){return ui(e.id)(e.value)});return function(t){var n=_u(t.values);return su(t)?e(n):"M "+rr(n[0].x)+" "+ui(t.id)(n[0].value)}}();var Yu,Zu=function(){};Yu=o.svg.brush().on("brush",ya);Yu.update=function(){if(ra){ra.select("."+n.brush).call(this)}return this};Yu.scale=function(e){return et?this.y(e):this.x(e)};if(m){Zu=o.behavior.zoom().on("zoomstart",function(){Zu.altDomain=o.event.sourceEvent.altKey?er.orgDomain():null}).on("zoom",m?ba:null);Zu.scale=function(e){return et?this.y(e):this.x(e)};Zu.orgScaleExtent=function(){var e=g?g:[1,10];return[e[0],Math.max(_s()/e[1],e[1])]};Zu.updateScaleExtent=function(){var e=cs(er.orgDomain())/cs(ua),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var ea,ta,na,ra,ia,sa,oa;var ua;var aa,fa={};u.focus=function(e){function s(e){Fs(e).transition().duration(100).style("opacity",1)}var t=ea.selectAll(lo(e)),r=t.filter(_a),i=t.filter(Da);u.revert();u.defocus();s(r.classed(n.focused,true));s(i);if(iu(u.data.targets)){Ki(e,true)}La(e)};u.defocus=function(e){function s(e){Fs(e).transition().duration(100).style("opacity",.3)}var t=ea.selectAll(lo(e)),r=t.filter(_a),i=t.filter(Da);u.revert();s(r.classed(n.focused,false));s(i);if(iu(u.data.targets)){Qi(e)}Aa(e)};u.revert=function(e){function s(e){Fs(e).transition().duration(100).style("opacity",1)}var t=ea.selectAll(lo(e)),r=t.filter(_a),i=t.filter(Da);s(r.classed(n.focused,false));s(i);if(iu(u.data.targets)){Qi(e)}Oa()};u.show=function(e){Us(e);ea.selectAll(lo(e)).transition().style("opacity",1);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.hide=function(e){Rs(e);ea.selectAll(lo(e)).transition().style("opacity",0);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.toggle=function(e){js(e)?u.hide(e):u.show(e)};u.unzoom=function(){Yu.clear().update();ga({withUpdateXDomain:true})};u.load=function(e){if(e.xs){Es(e.xs)}if("categories"in e&&bn){nt=e.categories;or.categories(nt)}if("cacheIds"in e&&hs(e.cacheIds)){Ta(ds(e.cacheIds),e.done);return}if("unload"in e){Ca(typeof e.unload==="string"?[e.unload]:typeof e.unload==="boolean"&&e.unload?Ps():e.unload,function(){Na(e)})}else{Na(e)}};u.unload=function(e){Ca(e?typeof e==="string"?[e]:e:Ps(),function(){ga({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})})};u.selected=function(e){return o.merge(na.selectAll("."+n.shapes+fo(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}na.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,u){var a=o.select(this),f=this.nodeName==="circle"?Cu:Au,l=this.nodeName==="circle"?ku:Ou,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}na.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=o.select(this),u=this.nodeName==="circle"?ku:Ou,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){Yo(e,"line");Sa()};u.toSpline=function(e){Yo(e,"spline");Sa()};u.toBar=function(e){Yo(e,"bar");Sa()};u.toScatter=function(e){Yo(e,"scatter");Sa()};u.toArea=function(e){Yo(e,"area");Sa()};u.toAreaSpline=function(e){Yo(e,"area-spline");Sa()};u.toPie=function(e){Yo(e,"pie");Sa({withTransform:true})};u.toDonut=function(e){Yo(e,"donut");Sa({withTransform:true})};u.groups=function(e){if(i(e)){return k}k=e;ga();return k};u.xgrids=function(e){if(!e){return Pt}Pt=e;ga();return Pt};u.xgrids.add=function(e){if(!e){return}return u.xgrids(Pt.concat(e))};u.xgrids.remove=function(e){var t=Pa(e);return u.xgrids(Pt.filter(t))};u.ygrids=function(e){if(!e){return Bt}Bt=e;ga();return Bt};u.ygrids.add=function(e){if(!e){return}return u.ygrids(Bt.concat(e))};u.ygrids.remove=function(e){var t=Pa(e);return u.ygrids(Bt.filter(t))};u.regions=function(e){if(i(e)){return rn}rn=e;ga();return rn};u.regions.add=function(e){if(i(e)){return rn}rn=rn.concat(e);ga();return rn};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();rn=rn.filter(function(t){return t.classes.indexOf(e)<0})});return rn};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=Bs(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]});Ma(u.data.targets,{withTransition:true});return C};u.x=function(e){if(arguments.length){xs(u.data.targets,e);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.xs=function(e){if(arguments.length){Ts(u.data.targets,e);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){di(t,e[t])});Ii()}};u.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){dt=+e.y}if(r(e.y2)){xt=+e.y2}}else{dt=xt=+e}ga()}};u.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){vt=+e.y}if(r(e.y2)){Tt=+e.y2}}else{vt=Tt=+e}ga()}};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;Sa({withLegend:true,withTransition:false})};u.destroy=function(){u.data.targets=undefined;u.data.x={};oa.html("");e.onresize=null};if("url"in t.data){o.csv(t.data.url,function(e,t){la(t)})}else if("rows"in t.data){la(Cs(t.data.rows))}else if("columns"in t.data){la(ks(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) \ No newline at end of file +(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 Or(){return h?h:Br()}function Mr(){var e=p?p:jr();return e>0?e:320}function _r(){if(iu(u.data.targets)){return 0}else if(d){return d}else{return et||!pt||yt?1:Pr("y")}}function Dr(){var e=1;if(iu(u.data.targets)){return 0}else if(v){return v}else if(vr){return Fn+(St&&!et?Pr("y2"):e)}else if(St){return kt||et?e:Pr("y2")}else{return e}}function Pr(e){var t=bi(e);return t.isInner?20+Fi(e):40+Fi(e)}function Hr(e){if(e==="y"&&!pt){return Q&&!vr?10:1}if(e==="y2"&&!St){return Cr}return(bi(e).isInner?30:40)+(e==="y2"?-10:0)}function Br(){return+o.select(c).style("width").replace("px","")}function jr(){return+o.select(c).style("height").replace("px","")}function Fr(e){return e?-(1+4):-(Ln.left-1)}function Ir(e){return e?-20:-1}function qr(){return Fr(!et)}function Rr(){return Ir(!et)}function Ur(){return Fr(et)}function zr(){return Ir(et)}function Wr(e){return e?Mn+2+4:Ln.left+20}function Xr(e){return e?80:Dn+2}function Vr(){return Wr(!et)}function $r(){return Xr(!et)}function Jr(){return Wr(et)}function Kr(){return Xr(et)}function Qr(){var e=et?Dn:Mn,t=_s(),n=os()*(eu(u.data.targets)?(t-(bn?.25:1))/t:.98);return t>1?e*n/(t-1):e}function Gr(e){mr=e}function Yr(e){gr=e}function Zr(e){yr=e}function ei(){return Q?vr?gr*(mr+1):Hn:0}function ti(){return Q?vr?Bn:yr*(mr+1):0}function ni(){var e,t=!er;Vn=et?1:0;$n=et?Dn:Mn;Jn=et?0:Dn;Kn=et?Mn:1;Qn=Vn;Gn=$n;Yn=et?0:Pn;Zn=et?_n:1;er=ii(Vn,$n,t?undefined:er.domain(),function(){return or.tickOffset()});tr=si(Jn,Kn);nr=si(Jn,Kn);rr=ii(Vn,$n,ua,function(e){return e%1?0:fr.tickOffset()});ir=si(Yn,Zn);sr=si(Yn,Zn);e=ci();or=ai(er,lr,e);fr=ai(rr,pr,e);ur=fi(tr,cr,bt,Et);ar=fi(nr,hr,Lt,Ot);if(!t){Yu.scale(rr);if(m){Zu.scale(er)}}ri()}function ri(){Un=Ui();zn=zi();Wn=zi(.98)}function ii(e,t,n,r){var u=(yn?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(bn){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 oi(e){return li(e)==="y2"?nr:tr}function ui(e){return li(e)==="y2"?sr:ir}function ai(e,t,n){var r=(bn?qi():o.svg.axis()).scale(e).orient(t);r.tickFormat(n);if(bn){r.tickCentered(rt)}else{r.tickOffset=function(){var e=et?Dn:Mn;return e*os()/_s()/2}}if(bn){r.categories(nt)}return r}function fi(e,t,n,r){return o.svg.axis().scale(e).orient(t).tickFormat(n).ticks(r).outerTickSize(0)}function li(e){return e in L?L[e]:"y"}function ci(){var e=yn?Cn:bn?$s:function(e){return e<0?e.toFixed(0):e};if(it){if(typeof it==="function"){e=it}else if(yn){e=function(e){return o.time.format(it)(e)}}}return e}function hi(e){var t;if(e==="y"){t=gt}else if(e==="y2"){t=Ct}else if(e==="x"){t=ht}return t}function pi(e){var t=hi(e);return typeof t==="string"?t:t?t.text:null}function di(e,t){var n=hi(e);if(typeof n==="string"){if(e==="y"){gt=t}else if(e==="y2"){Ct=t}else if(e==="x"){ht=t}}else if(n){n.text=t}}function vi(e,t){var n=hi(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 mi(){return vi("x",et?"inner-top":"inner-right")}function gi(){return vi("y",et?"inner-right":"inner-top")}function yi(){return vi("y2",et?"inner-right":"inner-top")}function bi(e){return e==="y2"?yi():e==="y"?gi():mi()}function wi(){return pi("x")}function Ei(){return pi("y")}function Si(){return pi("y2")}function xi(e,t){if(e){return t.isLeft?0:t.isCenter?Mn/2:Mn}else{return t.isBottom?-Dn:t.isMiddle?-Dn/2:0}}function Ti(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 Ni(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ci(){return xi(!et,mi())}function ki(){return xi(et,gi())}function Li(){return xi(et,yi())}function Ai(){return Ti(!et,mi())}function Oi(){return Ti(et,gi())}function Mi(){return Ti(et,yi())}function _i(){var e=mi();if(et){return e.isInner?"1.2em":-30-Fi("x")}else{return e.isInner?"-0.5em":"3em"}}function Di(){var e=gi();if(et){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-Fi("y")}}function Pi(){var e=yi();if(et){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+Fi("y2")}}function Hi(){return Ni(!et,mi())}function Bi(){return Ni(et,gi())}function ji(){return Ni(et,yi())}function Fi(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=Xs(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 is(e){var t=Ps(e),n=zs(e),r,i,s,u,a,f;if(k.length>0){f=Vs(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(Mt){o=i*.001}else{o=i*.01}return o}function ls(e){var t=[us(e),as(e)],n=t[0],r=t[1],i=fs(e,t),s=yn?new Date(n.getTime()-i):n-i,o=yn?new Date(r.getTime()+i):r+i;return[s,o]}function cs(e){return e[1]-e[0]}function hs(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=Ns(o,t,i);if(wn&&bn&&n===0&&o){if(i===0){nt=[]}nt.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){Yo(Ps(r).filter(function(e){return!(e in O)}),A)}r.forEach(function(e){ps(e.id_org,e)});return r}function As(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 Os(e){return e>0&&u.data.targets[0].values[e-1]?u.data.targets[0].values[e-1].x:undefined}function Ms(e){return e<_s()-1?u.data.targets[0].values[e+1].x:undefined}function _s(){return o.max(u.data.targets,function(e){return e.values.length})}function Ds(){var e=u.data.targets.length,t=0,n;if(e>1){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 Ps(e){e=i(e)?u.data.targets:e;return e.map(function(e){return e.id})}function Hs(e){var t=Ps(),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 $s(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(No(e,i))}if(e[s].x){f=f.concat(No(e,s))}return Lo(f,t)}return Co(e,t,i,s)}function ko(e,t){var n;n=e.map(function(e){return Co(e.values,t)});return Lo(n,t)}function Lo(e,t){var n,r;e.forEach(function(e){var i=Tu(e,t);if(il){o-=n+60}if(f+i>Mr()){f-=i+30}}sa.style("top",f+"px").style("left",o+"px")}function Po(){sa.style("display","none")}function Ho(e){var t=e.filter(function(e){return e&&r(e.value)});if(!sn){return}if(tu(u.data.targets)||iu(u.data.targets)){return}na.selectAll("line."+n.xgridFocus).style("visibility","visible").data([t[0]]).attr(et?"y1":"x1",Eo).attr(et?"y2":"x2",Eo)}function Bo(){na.select("line."+n.xgridFocus).style("visibility","hidden")}function jo(e){return e.x||e.x===0?er(e.x):null}function Fo(e,t){var n=Jo(),r=Ku(n);if(k.length>0){var i=r(e,t);return i[0][1]}return oi(e.id)(e.value)}function Io(){var e={},t=0,n,r;Fs(Bs(fu)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function zo(e,t){return Wt?Wt:t?e.tickOffset()*2*Xt/t:0}function Wo(){var e={},t=0,n,r;Fs(Bs(au)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function Jo(){var e={},t=0,n,r;Fs(Bs(su)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function Yo(e,t){var n=i(e)?Ps():e;if(typeof n==="string"){n=[n]}for(var r=0;r0}function xu(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function Tu(e,t){return Math.pow(er(e.x)-t[0],2)+Math.pow(tr(e.value)-t[1],2)}function Nu(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function Cu(e,t,r){U(t,e.node());na.select("."+n.selectedCircles+fo(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return Js(n.selectedCircle,r)}).attr("cx",et?Fo:jo).attr("cy",et?jo:Fo).attr("stroke",function(){return Nn(t.id)}).attr("r",zt*1.4).transition().duration(100).attr("r",zt)}function ku(e,t,r){z(t,e.node());na.select("."+n.selectedCircles+fo(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function Lu(e,t,n,r){e?Cu(t,n,r):ku(t,n,r)}function Au(e,t){U(t,e.node());e.transition().duration(100).style("fill",function(){return o.rgb(Nn(t.id)).darker(1)})}function Ou(e,t){z(t,e.node());e.transition().duration(100).style("fill",function(){return Nn(t.id)})}function Mu(e,t,n,r){e?Au(t,n,r):Ou(t,n,r)}function _u(e){return e.filter(function(e){return r(e.value)})}function Du(e,t){return(t?na.selectAll("."+n.circles+fo(t)):na).selectAll("."+n.circle+(r(e)?"-"+e:""))}function Pu(e,t){Du(e,t).classed(n.EXPANDED,true).attr("r",Ut)}function Hu(e){Du(e).filter(function(){return o.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",It)}function Bu(e){return na.selectAll("."+n.bar+(r(e)?"-"+e:""))}function ju(e){Bu(e).classed(n.EXPANDED,true)}function Fu(e){Bu(e).classed(n.EXPANDED,false)}function Ru(e,t){var n,r=$u(e,t);if(et){n=o.svg.area().x0(function(e,t){return oi(e.id)(0)}).x1(function(e,t){return oi(e.id)(e.value)}).y(Eo)}else{n=o.svg.area().x(Eo).y0(function(e,t){if(k.length>0){var n=r(e,t);return n[0][1]}return oi(e.id)(0)}).y1(function(e,t){if(k.length>0){var n=r(e,t);return n[1][1]}return oi(e.id)(e.value)})}return function(e,t){var r=_u(e.values),i,s;if(Zo([e],"area")||Zo([e],"area-spline")){uu(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(Zo([e],"area-step")){ou(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=er(r[0].x);s=oi(e.id)(r[0].value);return et?"M "+s+" "+i:"M "+i+" "+s}}}function Uu(e,t){var n=Ju(e,t);return function(e,t){var r=n(e,t);var i=et?1:0;var s=et?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 zu(e,t){var n=Ku(e,t),r=o.svg.line().x(et?function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return oi(e.id)(e.value)}:Eo).y(et?Eo:function(e,t){if(k.length>0){var r=n(e,t);return r[0][1]}return oi(e.id)(e.value)});return function(e){var t=_u(e.values),n,i;if(su(e)){uu(e)?r.interpolate("cardinal"):r.interpolate("linear");return D[e.id]?Gu(t,er,oi(e.id),D[e.id]):r(t)}else if(ou(e)){r.interpolate("step-after");return D[e.id]?Gu(t,er,oi(e.id),D[e.id]):r(t)}else{n=er(t[0].x);i=oi(e.id)(t[0].value);return et?"M "+i+" "+n:"M "+n+" "+i}}}function Wu(e,t){var n=Ju(e,false),r=t?Xu:Vu;return function(e,t){return r(n(e,t),e,this)}}function Xu(e,t){var n;if(et){n=fu(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 Vu(e,t,n){var r=n.getBBox();if(et){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:fu(t)?-3:-6)}}function $u(e,t){var n=e.__max__+1,r=Xo(n,e,!!t),i=Vo(!!t),s=$o(e,!!t),o=t?ui:oi;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(et){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function Ju(e,t){var n=e.__max__+1,r=zo(or,n),i=qo(r,n,e,!!t),s=Ro(!!t),o=Uo(e,!!t),u=t?ui:oi;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(et){if(e.value>0&&la){l=a}}return[[f,a],[f,l-(n-a)],[f+r,l-(n-a)],[f+r,a]]}}function Ku(e,t){var n=e.__max__+1,r=Ko(n,e,!!t),i=Qo(!!t),s=Go(e,!!t),o=t?ui:oi;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(et){if(e.value>0&&fu){f=u}}return[[a,f-(n-u)]]}}function Gu(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=vr?g:m;if(Z){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+""}),fn=l(["tooltip","init","show"],false),ln=l(["tooltip","init","x"],0),cn=l(["tooltip","init","position"],{top:"0px",left:"50px"});var hn=(typeof c==="string"?c.replace("#",""):c.id)+"-clip",pn=hn+"-xaxis",dn=hn+"-yaxis",vn=br(hn),mn=br(mn),gn=br(gn);var yn=tt==="timeseries",bn=tt==="categorized",wn=!yn&&(S||Su(x));var En=null,Sn=false,xn=false,Tn=false;var Nn=gu(P,J);var Cn=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 kn=[];var Ln,An,On,Mn,_n,Dn,Pn,Hn,Bn,jn,Fn;var In,qn,Rn,Un,zn,Wn,Xn;var Vn,$n,Jn,Kn,Qn,Gn,Yn,Zn;var er,tr,nr,rr,ir,sr,or,ur,ar,fr;var lr=et?"left":"bottom",cr=et?yt?"top":"bottom":yt?"right":"left",hr=et?kt?"bottom":"top":kt?"left":"right",pr=et?"left":"bottom";var dr={main:function(){return"translate("+Ln.left+","+Ln.top+")"},context:function(){return"translate("+An.left+","+An.top+")"},legend:function(){return"translate("+On.left+","+On.top+")"},x:function(){return"translate(0,"+(et?0:Dn)+")"},y:function(){return"translate(0,"+(et?Dn:0)+")"},y2:function(){return"translate("+(et?0:Mn)+","+(et?1:0)+")"},subx:function(){return"translate(0,"+(et?0:Pn)+")"},arc:function(){return"translate("+Mn/2+","+Dn/2+")"}};var vr=G==="right";var mr=0,gr=0,yr=0;var Tr=30,Nr=30,Cr=5;Xn=o.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Iu=function(){var e=o.svg.line().x(et?function(e){return oi(e.id)(e.value)}:Eo).y(et?Eo:function(e){return oi(e.id)(e.value)});return function(t){var n=_u(t.values),r,i;if(su(t)){uu(t)?e.interpolate("cardinal"):e.interpolate("linear");return D[t.id]?Gu(n,er,oi(t.id),D[t.id]):e(n)}else if(ou(t)){e.interpolate("step-after");return D[t.id]?Gu(n,er,oi(t.id),D[t.id]):e(n)}else{r=er(n[0].x);i=oi(t.id)(n[0].value);return et?"M "+i+" "+r:"M "+r+" "+i}}}();var qu=function(){var e;if(et){e=o.svg.area().x0(function(e){return oi(e.id)(0)}).x1(function(e){return oi(e.id)(e.value)}).y(Eo)}else{e=o.svg.area().x(Eo).y0(function(e){return oi(e.id)(0)}).y1(function(e){return oi(e.id)(e.value)})}return function(t){var n=_u(t.values),r,i;if(Zo([t],"area")||Zo([t],"area-spline")){uu(t)?e.interpolate("cardinal"):e.interpolate("linear");return e(n)}else if(Zo([t],"area-step")){ou(t)?e.interpolate("step-after"):"";return e(n)}else{r=er(n[0].x);i=oi(t.id)(n[0].value);return et?"M "+i+" "+r:"M "+r+" "+i}}}();var Qu=function(){var e=o.svg.line().x(et?function(e){return ui(e.id)(e.value)}:To).y(et?To:function(e){return ui(e.id)(e.value)});return function(t){var n=_u(t.values);return su(t)?e(n):"M "+rr(n[0].x)+" "+ui(t.id)(n[0].value)}}();var Yu,Zu=function(){};Yu=o.svg.brush().on("brush",ya);Yu.update=function(){if(ra){ra.select("."+n.brush).call(this)}return this};Yu.scale=function(e){return et?this.y(e):this.x(e)};if(m){Zu=o.behavior.zoom().on("zoomstart",function(){Zu.altDomain=o.event.sourceEvent.altKey?er.orgDomain():null}).on("zoom",m?ba:null);Zu.scale=function(e){return et?this.y(e):this.x(e)};Zu.orgScaleExtent=function(){var e=g?g:[1,10];return[e[0],Math.max(_s()/e[1],e[1])]};Zu.updateScaleExtent=function(){var e=cs(er.orgDomain())/cs(ua),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var ea,ta,na,ra,ia,sa,oa;var ua;var aa,fa={};u.focus=function(e){function s(e){Fs(e).transition().duration(100).style("opacity",1)}var t=ea.selectAll(lo(e)),r=t.filter(_a),i=t.filter(Da);u.revert();u.defocus();s(r.classed(n.focused,true));s(i);if(iu(u.data.targets)){Ki(e,true)}La(e)};u.defocus=function(e){function s(e){Fs(e).transition().duration(100).style("opacity",.3)}var t=ea.selectAll(lo(e)),r=t.filter(_a),i=t.filter(Da);u.revert();s(r.classed(n.focused,false));s(i);if(iu(u.data.targets)){Qi(e)}Aa(e)};u.revert=function(e){function s(e){Fs(e).transition().duration(100).style("opacity",1)}var t=ea.selectAll(lo(e)),r=t.filter(_a),i=t.filter(Da);s(r.classed(n.focused,false));s(i);if(iu(u.data.targets)){Qi(e)}Oa()};u.show=function(e){Us(e);ea.selectAll(lo(e)).transition().style("opacity",1);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.hide=function(e){Rs(e);ea.selectAll(lo(e)).transition().style("opacity",0);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.toggle=function(e){js(e)?u.hide(e):u.show(e)};u.unzoom=function(){Yu.clear().update();ga({withUpdateXDomain:true})};u.load=function(e){if(e.xs){Es(e.xs)}if("categories"in e&&bn){nt=e.categories;or.categories(nt)}if("cacheIds"in e&&hs(e.cacheIds)){Ta(ds(e.cacheIds),e.done);return}if("unload"in e){Ca(typeof e.unload==="string"?[e.unload]:typeof e.unload==="boolean"&&e.unload?Ps():e.unload,function(){Na(e)})}else{Na(e)}};u.unload=function(e){Ca(e?typeof e==="string"?[e]:e:Ps(),function(){ga({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})})};u.selected=function(e){return o.merge(na.selectAll("."+n.shapes+fo(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}na.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,u){var a=o.select(this),f=this.nodeName==="circle"?Cu:Au,l=this.nodeName==="circle"?ku:Ou,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}na.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=o.select(this),u=this.nodeName==="circle"?ku:Ou,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){Yo(e,"line");Sa()};u.toSpline=function(e){Yo(e,"spline");Sa()};u.toBar=function(e){Yo(e,"bar");Sa()};u.toScatter=function(e){Yo(e,"scatter");Sa()};u.toArea=function(e){Yo(e,"area");Sa()};u.toAreaSpline=function(e){Yo(e,"area-spline");Sa()};u.toPie=function(e){Yo(e,"pie");Sa({withTransform:true})};u.toDonut=function(e){Yo(e,"donut");Sa({withTransform:true})};u.groups=function(e){if(i(e)){return k}k=e;ga();return k};u.xgrids=function(e){if(!e){return Pt}Pt=e;ga();return Pt};u.xgrids.add=function(e){if(!e){return}return u.xgrids(Pt.concat(e))};u.xgrids.remove=function(e){var t=Pa(e);return u.xgrids(Pt.filter(t))};u.ygrids=function(e){if(!e){return Bt}Bt=e;ga();return Bt};u.ygrids.add=function(e){if(!e){return}return u.ygrids(Bt.concat(e))};u.ygrids.remove=function(e){var t=Pa(e);return u.ygrids(Bt.filter(t))};u.regions=function(e){if(i(e)){return rn}rn=e;ga();return rn};u.regions.add=function(e){if(i(e)){return rn}rn=rn.concat(e);ga();return rn};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();rn=rn.filter(function(t){return t.classes.indexOf(e)<0})});return rn};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=Bs(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]});Ma(u.data.targets,{withTransition:true});return C};u.x=function(e){if(arguments.length){xs(u.data.targets,e);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.xs=function(e){if(arguments.length){Ts(u.data.targets,e);ga({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){di(t,e[t])});Ii()}};u.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){dt=+e.y}if(r(e.y2)){xt=+e.y2}}else{dt=xt=+e}ga()}};u.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.y)){vt=+e.y}if(r(e.y2)){Tt=+e.y2}}else{vt=Tt=+e}ga()}};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;Sa({withLegend:true,withTransition:false})};u.destroy=function(){u.data.targets=undefined;u.data.x={};oa.html("");e.onresize=null};if("url"in t.data){o.csv(t.data.url,function(e,t){la(t)})}else if("rows"in t.data){la(Cs(t.data.rows))}else if("columns"in t.data){la(ks(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) \ No newline at end of file