From d17e62914e91e7edf8b51cb75eb51708173841a3 Mon Sep 17 00:00:00 2001 From: Brandon Bernal Date: Thu, 24 Apr 2014 15:01:47 -0400 Subject: [PATCH] MAP-5822: 'No Data' text made more configurable. --- c3.js | 21 ++++++++++++++++++--- c3.min.js | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index c70b3d8..5bf6f56 100644 --- a/c3.js +++ b/c3.js @@ -143,6 +143,12 @@ __data_ondragstart = getConfig(['data', 'ondragstart'], function () {}), __data_ondragend = getConfig(['data', 'ondragend'], function () {}); + // configuration for no plot-able data supplied. + var __data_empty_abort = getConfig(['data', 'empty', 'abort'], true); + var __data_empty_label_text = getConfig(['data', 'empty', 'label', 'text'], ""); + var __data_empty_label_size = getConfig(['data', 'empty', 'label', 'size'], false); + var __data_empty_label_fill = getConfig(['data', 'empty', 'label', 'fill'], false); + // subchart var __subchart_show = getConfig(['subchart', 'show'], false), __subchart_size_height = __subchart_show ? getConfig(['subchart', 'size', 'height'], 60) : 0; @@ -1213,8 +1219,8 @@ var xDomain = [getXDomainMin(targets), getXDomainMax(targets)], firstX = xDomain[0], lastX = xDomain[1], padding = getXDomainPadding(targets, xDomain), - min = isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding, - max = isTimeSeries ? new Date(lastX.getTime() + padding) : lastX + padding; + min = firstX == undefined ? padding : (isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding), + max = lastX == undefined ? padding : (isTimeSeries ? new Date(lastX.getTime() + padding) : lastX + padding); return [min, max]; } function diffDomain(d) { @@ -2595,6 +2601,15 @@ .style("display", "none"); /*-- Main Region --*/ + if (c3.data.targets.length == 0) { + main.append("text") + .attr("class", CLASS.text) + .attr("x", (main[0][0].parentNode.width.baseVal.value / 2) - margin.left) + .attr("y", (main[0][0].parentNode.height.baseVal.value / 2) - margin.top) + .attr("text-anchor", "middle") + .attr("style", (__data_empty_label_fill ? "fill:"+ __data_empty_label_fill +"; " : "") + (__data_empty_label_size ? "font-size:"+ __data_empty_label_size +"; " : "") ) + .text(__data_empty_label_text); + } // Add Axis main.append("g") @@ -3084,7 +3099,7 @@ var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling; // abort if no targets to show - if (targetsToShow.length === 0) { + if (targetsToShow.length === 0 && __data_empty_abort) { return; } diff --git a/c3.min.js b/c3.min.js index eb01d84..445fd8e 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 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,ca,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){na.scale(ur);if(m){ra.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}}fa.style("top",f+"px").style("left",o+"px")}function Fo(){fa.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}oa.selectAll("line."+n.xgridFocus).style("visibility","visible").data([t[0]]).attr(it?"y1":"x1",No).attr(it?"y2":"x2",No)}function qo(){oa.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());oa.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());oa.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?oa.selectAll("."+n.circles+po(t)):oa).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 oa.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]?ta(t,ir,li(e.id),D[e.id]):r(t)}else if(lu(e)){r.interpolate("step-after");return D[e.id]?ta(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 ta(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]?ta(n,ir,li(t.id),D[t.id]):e(n)}else if(lu(t)){e.interpolate("step-after");return D[t.id]?ta(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"):"";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);return fu(t)?e(n):"M "+ur(n[0].x)+" "+ci(t.id)(n[0].value)}}();var na,ra=function(){};na=o.svg.brush().on("brush",Sa);na.update=function(){if(ua){ua.select("."+n.brush).call(this)}return this};na.scale=function(e){return it?this.y(e):this.x(e)};if(m){ra=o.behavior.zoom().on("zoomstart",function(){ra.altDomain=o.event.sourceEvent.altKey?ir.orgDomain():null}).on("zoom",m?xa:null);ra.scale=function(e){return it?this.y(e):this.x(e)};ra.orgScaleExtent=function(){var e=g?g:[1,10];return[e[0],Math.max(Bs()/e[1],e[1])]};ra.updateScaleExtent=function(){var e=vs(ir.orgDomain())/vs(ca),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var ia,sa,oa,ua,aa,fa,la;var ca;var ha,pa={};u.focus=function(e){function s(e){Us(e).transition().duration(100).style("opacity",1)}var t=ia.selectAll(vo(e)),r=t.filter(Ba),i=t.filter(ja);u.revert();u.defocus();s(r.classed(n.focused,true));s(i);if(au(u.data.targets)){Zi(e,true)}_a(e)};u.defocus=function(e){function s(e){Us(e).transition().duration(100).style("opacity",.3)}var t=ia.selectAll(vo(e)),r=t.filter(Ba),i=t.filter(ja);u.revert();s(r.classed(n.focused,false));s(i);if(au(u.data.targets)){es(e)}Da(e)};u.revert=function(e){function s(e){Us(e).transition().duration(100).style("opacity",1)}var t=ia.selectAll(vo(e)),r=t.filter(Ba),i=t.filter(ja);s(r.classed(n.focused,false));s(i);if(au(u.data.targets)){es(e)}Pa()};u.show=function(e){Vs(e);ia.selectAll(vo(e)).transition().style("opacity",1);Ea({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.hide=function(e){Xs(e);ia.selectAll(vo(e)).transition().style("opacity",0);Ea({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:false})};u.toggle=function(e){Rs(e)?u.hide(e):u.show(e)};u.unzoom=function(){na.clear().update();Ea({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)){La(ys(e.cacheIds),e.done);return}if("unload"in e){Oa(typeof e.unload==="string"?[e.unload]:typeof e.unload==="boolean"&&e.unload?Fs():e.unload,function(){Aa(e)})}else{Aa(e)}};u.unload=function(e){Oa(e?typeof e==="string"?[e]:e:Fs(),function(){Ea({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})})};u.selected=function(e){return o.merge(oa.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}oa.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}oa.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");Ca()};u.toSpline=function(e){nu(e,"spline");Ca()};u.toBar=function(e){nu(e,"bar");Ca()};u.toScatter=function(e){nu(e,"scatter");Ca()};u.toArea=function(e){nu(e,"area");Ca()};u.toAreaSpline=function(e){nu(e,"area-spline");Ca()};u.toPie=function(e){nu(e,"pie");Ca({withTransform:true})};u.toDonut=function(e){nu(e,"donut");Ca({withTransform:true})};u.groups=function(e){if(i(e)){return k}k=e;Ea();return k};u.xgrids=function(e){if(!e){return Ft}Ft=e;Ea();return Ft};u.xgrids.add=function(e){if(!e){return}return u.xgrids(Ft.concat(e))};u.xgrids.remove=function(e){var t=Fa(e);return u.xgrids(Ft.filter(t))};u.ygrids=function(e){if(!e){return qt}qt=e;Ea();return qt};u.ygrids.add=function(e){if(!e){return}return u.ygrids(qt.concat(e))};u.ygrids.remove=function(e){var t=Fa(e);return u.ygrids(qt.filter(t))};u.regions=function(e){if(i(e)){return an}an=e;Ea();return an};u.regions.add=function(e){if(i(e)){return an}an=an.concat(e);Ea();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;ia.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]});Ha(u.data.targets,{withTransition:true});return C};u.x=function(e){if(arguments.length){ks(u.data.targets,e);Ea({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return u.data.x};u.xs=function(e){if(arguments.length){Ls(u.data.targets,e);Ea({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}Ea()}};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}Ea()}};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;Ca({withLegend:true,withTransition:false})};u.destroy=function(){u.data.targets=undefined;u.data.x={};la.html("");e.onresize=null};if("url"in t.data){o.csv(t.data.url,function(e,t){da(t)})}else if("rows"in t.data){da(Os(t.data.rows))}else if("columns"in t.data){da(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) \ No newline at end of file