From e29f418c9ed4367d9a9509b778f7dd3bf906d461 Mon Sep 17 00:00:00 2001 From: Brandon Bernal Date: Thu, 22 May 2014 10:56:08 -0400 Subject: [PATCH] Updated c3.min.js --- c3.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.min.js b/c3.min.js index b0ccc80..53a6567 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"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e=0;return"url("+(n?"":document.URL.split("#")[0])+"#"+t+")"}function li(e){return Math.ceil(e)+.5}function ci(e,t){var r,i,s;if(t&&t.axisX){r=t.axisX}else{r=If.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=If.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=If.select("."+n.axisY2);if(e){s=s.transition()}}If.attr("transform",ri.main);r.attr("transform",ri.x);i.attr("transform",ri.y);s.attr("transform",ri.y2);If.select("."+n.chartArcs).attr("transform",ri.arc)}function hi(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=qf.select("."+n.axisX);if(e){r=r.transition()}}qf.attr("transform",ri.context);r.attr("transform",ri.subx)}function pi(e){(e?Rf.transition():Rf).attr("transform",ri.legend)}function di(e,t){ci(e,t);if(ot){hi(e,t)}pi(e)}function yi(){var e=Qi(),t=Ki(),n=ii?0:e,r=ka(a.data.targets),i=gt||r?0:Ai("x"),s=ot&&!r?ut+i:0;xr=Si();Tr=xi();if(gt){mr={top:Ai("y2")+Ti(),right:r?0:ki(),bottom:Ai("y")+n+Ni(),left:s+(r?0:Ci())};gr={top:mr.top,right:NaN,bottom:20+n,left:vi}}else{mr={top:4+Ti(),right:r?0:ki(),bottom:i+s+n+Ni(),left:r?0:Ci()};gr={top:Tr-s-n,right:NaN,bottom:i+n,left:mr.left}}yr={top:ii?0:Tr-e,right:NaN,bottom:0,left:ii?xr-t:0};br=xr-mr.left-mr.right;Er=Tr-mr.top-mr.bottom;if(br<0){br=0}if(Er<0){Er=0}wr=gt?mr.left-vi-mi:br;Sr=gt?Er:Tr-gr.top-gr.bottom;if(wr<0){wr=0}if(Sr<0){Sr=0}Lr=br-(ii?t+10:0);Ar=Er-(ii?0:10);wi();if(ii&&r){yr.left=Lr/2+Cr*1.1}}function bi(){If.select("line."+n.xgridFocus).attr("x1",gt?0:-10).attr("x2",gt?br:-10).attr("y1",gt?-10:mr.top).attr("y2",gt?-10:Er)}function wi(){Cr=Math.min(Lr,Ar)/2;Nr=Cr*.95;var e=Dn?(Nr-Dn)/Nr:.6;kr=Ca(a.data.targets)||Na(a.data.targets)?Nr*e:0}function Ei(){var e=gt?n.axisX:n.axisY,t=If.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=zf.node().getBoundingClientRect(),s=ka(a.data.targets),o=r.right-i.left-(s?0:Ci());return o>0?o:0}function Si(){return p?p:Mi()}function xi(){var e=d?d:_i();return e>0?e:320}function Ti(){return g?g:0}function Ni(){return y?y:0}function Ci(){if(v){return v}else if(gt){return!yt?1:Math.max(sf(Li("x")),40)}else{return!Bt||Rt?1:sf(Li("y"))}}function ki(){var e=10,t=ii?Ki()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:sf(Li("y2")))+t}}function Li(e){var t=ys(e);return t.isInner?20+js(e):40+js(e)}function Ai(e){if(e==="x"&&!yt){return 0}if(e==="x"&&Dt){return Dt}if(e==="y"&&!Bt){return ct&&!ii?10:1}if(e==="y2"&&!Xt){return gi}return(ys(e).isInner?30:40)+(e==="y2"?-10:0)}function Oi(e){var t=zf.node(),n;while(t&&t.tagName!=="BODY"){n=t.getBoundingClientRect()[e];if(n){break}t=t.parentNode}return n}function Mi(){return Oi("width")}function _i(){var e=zf.style("height");return e.indexOf("px")>0?+e.replace("px",""):0}function Di(e){return e?-(1+30):-(mr.left-1)}function Pi(e){return e?-20:-4}function Hi(){return Di(!gt)}function Bi(){return Pi(!gt)}function ji(){return Di(gt)}function Fi(){return Pi(gt)}function Ii(e){return e?br+2+30+30:mr.left+20}function qi(e){return e?(Dt?Dt:0)+80:Er+8}function Ri(){return Ii(!gt)}function Ui(){return qi(!gt)}function zi(){return Ii(gt)}function Wi(){return qi(gt)}function Xi(){var e=Ho(a.data.targets),t,n,r,i,s,o;if(!e){return 0}t=e.values[0],n=e.values[e.values.length-1];r=Ur(n.x)-Ur(t.x);if(r===0){return gt?Er:br}i=Po();s=Sa(a.data.targets)?(i-(nr?.25:1))/i:1;o=i>1?r*s/(i-1):r;return o<1?1:o}function Vi(e){si=e}function $i(e){oi=e}function Ji(e){ui=e}function Ki(){return ct?ii?oi*(si+1):xr:0}function Qi(){return ct?ii?Tr:ui*(si+1):0}function Gi(){var e,t,n=!Ur;Pr=gt?1:0;Hr=gt?Er:br;Br=gt?0:Er;jr=gt?br:1;Fr=Pr;Ir=Hr;qr=gt?0:Sr;Rr=gt?wr:1;Ur=es(Pr,Hr,n?undefined:Ur.domain(),function(){return Jr.tickOffset()});zr=ts(Br,jr,n?undefined:zr.domain());Wr=ts(Br,jr,n?undefined:Wr.domain());Xr=es(Pr,Hr,Wf,function(e){return e%1?0:Gr.tickOffset()});Vr=ts(qr,Rr,n?undefined:Vr.domain());$r=ts(qr,Rr,n?undefined:$r.domain());e=us();t=Lt?Lt:n?undefined:Jr.tickValues();Jr=is(Ur,Zr,e,t);Gr=is(Xr,ni,e,t);Kr=ss(zr,ei,Ut,Wt);Qr=ss(Wr,ti,Gt,Zt);if(!n){Hf.scale(Xr);if(b){Bf.scale(Ur)}}Yi()}function Yi(){Or=qs();Mr=Rs();_r=Rs(.98)}function Zi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function es(e,t,n,r){var i=Zi(e,t,tr),s=n?i.domain(n):i,o;if(nr){r=r||function(){return 0};i=function(e,t){var n=s(e)+r(e);return t?n:Math.ceil(n)}}else{i=function(e,t){var n=s(e);return t?n:Math.ceil(n)}}for(o in s){i[o]=s[o]}i.orgDomain=function(){var e=s.domain();if(Wf&&Wf[0]===e[0]&&Wf[1]=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}}function vs(){return ds("x",gt?"inner-top":"inner-right")}function ms(){return ds("y",gt?"inner-right":"inner-top")}function gs(){return ds("y2",gt?"inner-right":"inner-top")}function ys(e){return e==="y2"?gs():e==="y"?ms():vs()}function bs(){return fs("x")}function ws(){return fs("y")}function Es(){return fs("y2")}function Ss(e,t){if(e){return t.isLeft?0:t.isCenter?br/2:br}else{return t.isBottom?-Er:t.isMiddle?-Er/2:0}}function xs(e,t){if(e){return t.isLeft?"0.5em":t.isRight?"-0.5em":"0"}else{return t.isTop?"-0.5em":t.isBottom?"0.5em":"0"}}function Ts(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ns(){return Ss(!gt,vs())}function Cs(){return Ss(gt,ms())}function ks(){return Ss(gt,gs())}function Ls(){return xs(!gt,vs())}function As(){return xs(gt,ms())}function Os(){return xs(gt,gs())}function Ms(){var e=vs();if(gt){return e.isInner?"1.2em":-25-js("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function _s(){var e=ms();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-js("y")}}function Ds(){var e=gs();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+js("y2")}}function Ps(){return Ts(!gt,vs())}function Hs(){return Ts(gt,ms())}function Bs(){return Ts(gt,gs())}function js(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;u.selectAll("."+r+" .tick text").each(function(){var e=this.getBoundingClientRect();if(ts?s:e.value)}return t?e:null}function qs(){var e=u.svg.arc().outerRadius(Nr).innerRadius(kr),t=function(t,n){var r;if(n){return e(t)}r=Is(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function Rs(e){var t=u.svg.arc().outerRadius(Cr*(e?e:1)).innerRadius(kr);return function(e){var n=Is(e);return n?t(n):"M 0 0"}}function Us(e,t){return ja(e.data)?Or(e,t):"M 0 0"}function zs(e){var t=Is(e),n,r,i,s,o,u="";if(t){n=Or.centroid(t);r=n[0];i=n[1];s=Math.sqrt(r*r+i*i);o=(36/Nr>.375?1.175-36/Nr:.8)*Nr/s;u=Mn=="arc"?"translate(1,1)":"translate("+r*o+","+i*o+")"}return u}function Ws(e){var t=Mn=="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Xs(e){return To({id:e.data.id,value:e.value,ratio:Ws(e)})}function Vs(e){var t,n,r,i;if(!Ks()){return""}t=Is(e);n=t?t.value:null;r=Ws(t);i=Qs();return i?i(n,r):Iu(n,r)}function $s(e,t){var r=jf.selectAll("."+n.chartArc+Nu(e)),i=jf.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Xa(e)){r.selectAll("path").transition().duration(50).attr("d",Mr).transition().duration(100).attr("d",_r).each(function(e){if(Ba(e.data)){}})}if(!t){i.style("opacity",.3)}}function Js(e){var t=jf.selectAll("."+n.chartArc+Nu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Or);jf.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Ks(){if(Na(a.data.targets)){return true}return Ca(a.data.targets)?Pn:gn}function Qs(){if(Na(a.data.targets)){return Nn}return Ca(a.data.targets)?Hn:yn}function Gs(){return Ca(a.data.targets)?jn:""}function Ys(){if(Na(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Ca(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Zs(){if(Na(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Ca(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function eo(){if(Na(a.data.targets)){return typeof On==="function"?On:function(){}}var e=Ca(a.data.targets)?qn:Sn;return typeof e==="function"?e:function(){}}function to(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Go(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return u.min(Object.keys(n).map(function(e){return u.min(n[e])}))}function no(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Yo(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?n/(i-1)/2:.5}else if(en){s=n*.001}else{s=n*.01}if(typeof _t==="object"&&Za(_t)){o=r(_t.left)?_t.left:s;u=r(_t.right)?_t.right:s}else if(typeof _t==="number"){o=u=_t}else{o=u=s}return{left:o,right:u}}function uo(e){var t=[io(e),so(e)],n=t[0],r=t[1],i=oo(e),s=0,o=0;if(n-r===0&&!nr){n=tr?new Date(n.getTime()*.5):-.5;r=tr?new Date(r.getTime()*1.5):.5}if(n||n===0){s=tr?new Date(n.getTime()-i.left):n-i.left}if(r||r===0){o=tr?new Date(r.getTime()+i.right):r+i.right}return[s,o]}function ao(e){return e[1]-e[0]}function fo(e){for(var t=0;t=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r).map(function(e,n){return ko(e,t,n)})}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Za(A)){a.data.xs[t]=wo(i,a.data.targets)}}else{a.data.xs[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!a.data.xs[e]){throw new Error('x is not defined for id = "'+e+'".')}});i=t.map(function(t,n){var r=M(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=bo(t),o=e[s],u=ko(o,t,i);if(rr&&nr&&n===0&&o){if(i===0){Et=[]}Et.push(o)}if(typeof e[t]==="undefined"||a.data.xs[t].length<=i){u=undefined}return{x:u,value:e[t]!==null&&!isNaN(e[t])?+e[t]:null,id:r}}).filter(function(e){return typeof e.x!=="undefined"})}});i.forEach(function(e){var t;e.values=e.values.sort(function(e,t){var n=e.x||e.x===0?e.x:Infinity,r=t.x||t.x===0?t.x:Infinity;return n-r});t=0;e.values.forEach(function(e){e.index=t++})});if(B){wa(jo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){lo(e.id_org,e)});return i}function Mo(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}}function _o(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function Do(e){return e1){e.forEach(function(e){if(e.values.length>n){r=e;n=e.values.length}})}else{r=t?e[0]:null}return r}function Bo(e){var t=Ho(e),n,r;if(!t){return[0,0]}n=t.values[0],r=t.values[t.values.length-1];return[n.x,r.x]}function jo(e){return e.map(function(e){return e.id})}function Fo(e){return e?typeof e==="string"?[e]:e:jo(a.data.targets)}function Io(e,t){var n=jo(e),r;for(r=0;r2){o=r-2;i=e[0];s=e[e.length-1];u=(s-i)/(o+1);n=[i];for(a=0;a0})}function Zo(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||e[i].x===0){f=f.concat(Xu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Xu(e,s))}return Ju(f,t)}return Vu(e,t,i,s)}function $u(e,t){var n;n=e.map(function(e){return Vu(e.values,t)});return Ju(n,t)}function Ju(e,t){var n,r;e.forEach(function(e){var i=tf(e,t);if(il){o-=u-l}if(f+i>xi()){f-=i+30}}Uf.style("top",f+"px").style("left",o+"px")}function ta(){Uf.style("display","none")}function na(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Un){return}if(xa(a.data.targets)||ka(a.data.targets)){return}var i=If.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",Ru).attr(gt?"y2":"x2",Ru);tl(i,"grid")}function ra(){If.select("line."+n.xgridFocus).style("visibility","hidden")}function ia(e,t){var r=[],i,s,o,u,a=If.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=uo();s=i[0].getFullYear();o=i[1].getFullYear();for(u=s;u<=o;u++){r.push(new Date(u+"-01-01 00:00:00"))}}else{r=t.ticks(10)}return r.slice(0,a)}function sa(e){return e.x||e.x===0?Ur(e.x):null}function oa(e,t){var n=ma(),r=Df(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ns(e.id)(e.value)}function ua(){var e={},t=0,n,r;Uo(a.data.targets.filter(_a)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ca(e,t){return typeof vn==="number"?vn:t?e.tickOffset()*2*mn/t:0}function ha(){var e={},t=0,n,r;Uo(a.data.targets.filter(Ma)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ma(){var e={},t=0,n,r;Uo(a.data.targets.filter(La)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function wa(e,t){Fo(e).forEach(function(e){Vf[e]=t===j[e];j[e]=t});if(!e){B=t}}function Ea(e,t){var n=false;e.forEach(function(e){if(j[e.id]===t){n=true}if(!(e.id in j)&&t==="line"){n=true}});return n}function Sa(e){return Ea(e,"bar")}function xa(e){return Ea(e,"scatter")}function Ta(e){return B==="pie"||Ea(e,"pie")}function Na(e){return Ea(e,"gauge")}function Ca(e){return B==="donut"||Ea(e,"donut")}function ka(e){return Ta(e)||Ca(e)||Na(e)}function La(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="line"||j[t]==="spline"||j[t]==="area"||j[t]==="area-spline"}function Aa(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ba(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function ja(e){return Pa(e)||Ba(e)||Ha(e)}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Aa(e)?[e]:[]}function qa(e){return ja(e.data)?[e]:[]}function Ra(e){return _a(e)?e.values:[]}function Ua(e){return La(e)||Da(e)?e.values:[]}function za(e){return La(e)||Aa(e)?[e]:[]}function Wa(e){return _a(e)||La(e)?e.values:[]}function Xa(e){return Ba(e)&&Bn||Pa(e)&&bn}function Va(e,t,n){var r=[];return function(i){var s=i.id||i,o;if(e[s]instanceof Function){o=e[s](i)}else if(e[s]){o=e[s]}else{if(r.indexOf(s)<0){r.push(s)}o=t[r.indexOf(s)%t.length]}return n instanceof Function?n(o,i):o}}function $a(e,t){var n=e,r=t;return function(e){for(var t=1;t0}function ef(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function tf(e,t){var n=os(e.id)==="y"?zr:Wr,r=gt?1:0,i=gt?0:1;return Math.pow(Ur(e.x)-t[r],2)+Math.pow(n(e.value)-t[i],2)}function nf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function rf(e,t,n){return s(e[t])?e[t]:n}function sf(e){return Math.ceil(e/10)*10}function of(e,t){var n;u.select("body").selectAll(".dummy").data([e]).enter().append("text").classed(t?t:"",true).text(e).each(function(){n=this.getBoundingClientRect()}).remove();return n}function uf(e,t,r){Y(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return eu(n.selectedCircle,r)}).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa).attr("stroke",function(){return lr(t)}).attr("r",yf(t)*1.4).transition().duration(100).attr("r",yf)}function af(e,t,r){Z(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function ff(e,t,n,r){e?uf(t,n,r):af(t,n,r)}function lf(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(lr(t)).brighter(.75)})}function cf(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return lr(t)})}function hf(e,t,n,r){e?lf(t,n,r):cf(t,n,r)}function pf(e,t,n,r){hf(e,t,n.data,r)}function df(e){return e.nodeName==="circle"?ff:u.select(e).classed(n.bar)?hf:pf}function vf(e){return e.filter(function(e){return r(e.value)})}function mf(e){return an?typeof fn==="function"?fn(e):fn:0}function gf(e){return cn?hn?hn:mf(e)*1.75:mf(e)}function yf(e){return pn?pn:mf(e)*4}function bf(e,t){return(t?If.selectAll("."+n.circles+Tu(t)):If).selectAll("."+n.circle+(r(e)?"-"+e:""))}function wf(e,t){bf(e,t).classed(n.EXPANDED,true).attr("r",gf)}function Ef(e){bf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",mf)}function Sf(e){return If.selectAll("."+n.bar+(r(e)?"-"+e:""))}function xf(e){Sf(e).classed(n.EXPANDED,true)}function Tf(e){Sf(e).classed(n.EXPANDED,false)}function Nf(e,t){var n,r=Mf(e,t),i=t?rs:ns;if(gt){n=u.svg.area().x0(function(e,t){return i(e.id)(0)}).x1(function(e,t){return i(e.id)(e.value)}).y(Ru)}else{n=u.svg.area().x(Ru).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return i(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return i(e.id)(e.value)})}return function(e,t){var r=vf(e.values),i,s;if(Ea([e],"area")||Ea([e],"area-spline")){Oa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(Ea([e],"area-step")){Aa(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=Ur(r[0].x);s=ns(e.id)(r[0].value);return gt?"M "+s+" "+i:"M "+i+" "+s}}}function Cf(e,t){var n=Df(e,t),r=t?rs:ns,i=t?Wu:Ru,s=function(e,t){if(P.length>0){var i=n(e,t);return i[0][1]}return r(e.id)(e.value)},o=u.svg.line().x(gt?s:i).y(gt?i:s);if(!dn){o=o.defined(function(e){return e.value!=null})}return function(e){var n=dn?vf(e.values):e.values,i=t?i:Xr,s=r(e.id),u=0,a=0;if(La(e)){if(q[e.id]){return Pf(n,i,s,q[e.id])}else{o.interpolate(Oa(e)?"cardinal":"linear");return o(n)}}else if(Aa(e)){o.interpolate("step-after");return o(n)}else{if(n[0]){u=i(n[0].x);a=s(n[0].value)}return gt?"M "+a+" "+u:"M "+u+" "+a}}}function kf(e,t){var n=_f(e,t);return function(e,t){var r=n(e,t);var i=gt?1:0;var s=gt?0:1;var o="M "+r[0][i]+","+r[0][s]+" "+"L"+r[1][i]+","+r[1][s]+" "+"L"+r[2][i]+","+r[2][s]+" "+"L"+r[3][i]+","+r[3][s]+" "+"z";return o}}function Lf(e,t){var n=_f(e,false),r=t?Af:Of;return function(e,t){return r(n(e,t),e,this)}}function Af(e,t){var n;if(gt){n=_a(t)?4:6;return e[2][1]+n*(t.value<0?-1:1)}else{return e[0][0]+(e[2][0]-e[0][0])/2}}function Of(e,t,n){var r=n.getBoundingClientRect();if(gt){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:_a(t)?-3:-6)}}function Mf(e,t){var n=e.__max__+1,r=pa(n,e,!!t),i=da(!!t),s=va(e,!!t),o=t?rs:ns;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function _f(e,t){var n=e.__max__+1,r=ca(Jr,n),i=aa(r,n,e,!!t),s=fa(!!t),o=la(e,!!t),u=t?rs:ns;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(gt){if(00&&fu){f=u}}return[[a,f-(n-u)]]}}function Pf(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m,g;var y,b;var w=[];if(s(r)){for(u=0;u=0){u.select(this).style("display",t%mt?"none":"block")}})}else{jf.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){ps(Yr.x,t.axisX,At)}G=Nf(_,false);Z=kf(D);tt=Cf(P,false);it=Lf(D,true);st=Lf(D,false);Vr.domain(zr.domain());$r.domain(Wr.domain());Uf.style("display","none");bi();If.select("line."+n.xgridFocus).style("visibility","hidden");if(tn){o=ia(nn,Ur);B=nr?Jr.tickOffset():0;s=gt?{x1:0,x2:br,y1:function(e){return Ur(e)-B},y2:function(e){return Ur(e)-B}}:{x1:function(e){return Ur(e)+B},x2:function(e){return Ur(e)+B},y1:mr.top,y2:Er};i=If.select("."+n.xgrids).selectAll("."+n.xgrid).data(o);i.enter().append("line").attr("class",n.xgrid);i.attr(s).style("opacity",function(){return+u.select(this).attr(gt?"y1":"x1")===(gt?Er:0)?0:1});i.exit().remove()}if(Za(rn)){f=If.select("."+n.xgridLines).selectAll("."+n.xgridLine).data(rn);l=f.enter().append("g").attr("class",function(e){return n.xgridLine+(e.class?e.class:"")});l.append("line").style("opacity",0);l.append("text").attr("text-anchor","end").attr("transform",gt?"":"rotate(-90)").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);f.select("line").transition().duration(ut).attr("x1",gt?0:Uu).attr("x2",gt?br:Uu).attr("y1",gt?Uu:mr.top).attr("y2",gt?Uu:Er).style("opacity",1);f.select("text").transition().duration(ut).attr("x",gt?br:0).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(ut).style("opacity",0).remove()}if(I&&sn){c=If.select("."+n.ygrids).selectAll("."+n.ygrid).data(zr.ticks(un));c.enter().append("line").attr("class",n.ygrid);c.attr("x1",gt?zr:0).attr("x2",gt?zr:br).attr("y1",gt?0:zr).attr("y2",gt?Er:zr);c.exit().remove();tl(c,"grid")}if(I&&Za(on)){h=If.select("."+n.ygridLines).selectAll("."+n.ygridLine).data(on);p=h.enter().append("g").attr("class",function(e){return n.ygridLine+(e.class?e.class:"")});p.append("line").style("opacity",0);p.append("text").attr("text-anchor","end").attr("transform",gt?"rotate(-90)":"").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);h.select("line").transition().duration(ut).attr("x1",gt?zu:0).attr("x2",gt?zu:br).attr("y1",gt?0:zu).attr("y2",gt?Er:zu).style("opacity",1);h.select("text").transition().duration(ut).attr("x",gt?0:br).attr("y",zu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(ut).style("opacity",0).remove()}E=If.select("."+n.regions).selectAll("."+n.region).data(Rn);E.enter().append("g").attr("class",vu).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(ut).attr("x",ho).attr("y",po).attr("width",vo).attr("height",mo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(ut).style("opacity",0).remove();y=If.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);y.enter().append("path").attr("class",fu).style("stroke",function(e){return lr(e.id)}).style("stroke-width",2).style("opacity",0).style("fill",function(e){return lr(e.id)}).style("fill-opacity",function(){if(ft){return ft}return Au});y.style("opacity",Au).transition().duration(ut).attr("d",Z).style("fill",lr).style("opacity",1);y.exit().transition().duration(at).style("opacity",0).remove();d=If.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);d.enter().append("path").attr("class",su).style("stroke",lr);d.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);d.exit().transition().duration(at).style("opacity",0).remove();v=If.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);v.enter().append("path").attr("class",gu).style("stroke",lr);v.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);v.exit().transition().duration(at).style("opacity",0).remove();m=If.selectAll("."+n.areas).selectAll("."+n.area).data(za);m.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(ut).attr("d",G).style("fill",lr).style("opacity",Xf);m.exit().transition().duration(at).style("opacity",0).remove();if(an){g=If.selectAll("."+n.circles).selectAll("."+n.circle).data(Ua);g.enter().append("circle").attr("class",uu).attr("r",mf).style("fill",lr);g.style("opacity",Au).transition().duration(ut).style("opacity",Mu).style("fill",lr).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);g.exit().remove()}if(Du()){x=If.selectAll("."+n.texts).selectAll("."+n.text).data(Wa);x.enter().append("text").attr("class",tu).attr("text-anchor",function(e){return gt?e.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",lr).style("fill-opacity",0);x.text(function(e){return qu(e.id)(e.value,e.id)}).style("fill-opacity",Ou).transition().duration(ut).attr("x",it).attr("y",st).style("fill",lr).style("fill-opacity",_u);x.exit().transition().duration(at).style("fill-opacity",0).remove()}w=If.selectAll("."+n.arcs).selectAll("."+n.arc).data(qa);if(Mn==="arc"){w.enter().append("path").attr("class","").style("opacity",1).style("fill",xn).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(e){e.value=Cn;e.startAngle=-1*(Math.PI/2);e.endAngle=Math.PI/2;return Us(e,true)});w.exit().transition().duration(at).style("opacity",0).remove()}w.enter().append("path").attr("class",cu).style("fill",function(e){return lr(e.data)}).style("cursor",function(e){return $(e)?"pointer":null}).style("opacity",0).each(function(e){this._current=e}).on("mouseover",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=Zs();$s(n.data.id);vl(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Is(e),n=Xs(t),r=[n];ea(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=eo();Js(n.data.id);ml();ta();i(r,t)}).on("click",function(e,t){var n=Is(e),r=Xs(n),i=Ys();Gf(this,e,t);i(r,t)});w.attr("transform",W?"scale(0)":"").style("opacity",function(e){return e===this._current?0:1}).each(function(){ar=true}).transition().duration(ut).attrTween("d",function(e){var t=Is(e),n;if(!t){return function(){return"M 0 0"}}if(isNaN(this._current.endAngle))this._current.endAngle=this._current.startAngle;n=u.interpolate(this._current,t);this._current=n(0);return function(e){return Us(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return Mn==="arc"&<?cr(e.data.values[0].value):lr(e.data.id)}).style("opacity",ft?ft:1).call(nf,function(){ar=false});w.exit().transition().duration(at).style("opacity",0).remove();If.selectAll("."+n.chartArc).select("text").style("opacity",0).text(Vs).attr("transform",zs).transition().duration(ut).style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});if(Mn==="arc"){If.selectAll("."+n.chartArc).select("text.units").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?_n:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.min").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?kn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.max").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?Cn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0})}If.select("."+n.chartArcsTitle).style("opacity",Ca(a.data.targets)||Na(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){Hf.extent(Ur.orgDomain()).update()}if(q){if(!gt&&At){ps(Yr.subx,t.axisSubX,At)}if(!Hf.empty()){Hf.extent(Ur.orgDomain()).update()}Y=Nf(_,true);et=kf(D,true);rt=Cf(P,true);L=qf.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);L.enter().append("path").attr("class",fu).style("stroke","none").style("fill",lr);L.style("opacity",Au).transition().duration(ut).attr("d",et).style("opacity",1);L.exit().transition().duration(ut).style("opacity",0).remove();T=qf.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);T.enter().append("path").attr("class",su).style("stroke",lr);T.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);T.exit().transition().duration(ut).style("opacity",0).remove();N=qf.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);N.enter().append("path").attr("class",su).style("stroke",lr);N.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);N.exit().transition().duration(ut).style("opacity",0).remove();C=qf.selectAll("."+n.areas).selectAll("."+n.area).data(Aa?Ia:Fa);C.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(ut).attr("d",Y).style("fill",lr).style("opacity",Xf);C.exit().transition().duration(at).style("opacity",0).remove()}}If.selectAll("."+n.selectedCircles).filter(function(e){return _a(e)}).selectAll("circle").remove();If.selectAll("."+n.selectedCircle).transition().duration(ut).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);if(S){O=If.select("."+n.eventRects);if(Za(A)&&!xo(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Qf(M.enter());M.attr("x",0).attr("y",0).attr("width",br).attr("height",Er)}else{if(!O.classed(n.eventRectsSingle)){O.classed(n.eventRectsMultiple,false).classed(n.eventRectsSingle,true).selectAll("."+n.eventRect).remove()}if((rr||tr)&&!nr){F=function(e,t){var n=_o(t),r=Do(t),i=a.data.xs[e.id][t];var s=Ur(r?r:i);var o=Ur(n?n:i);return(s-o)/2};j=function(e,t){var n=_o(t),r=a.data.xs[e.id][t];return(Ur(r)+Ur(n?n:r))/2}}else{F=Xi();j=function(e){return Ur(e.x)-F/2}}H=Ho(a.data.targets);If.select("."+n.eventRects).datum(H?H.values:[]);M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Kf(M.enter());M.attr("class",mu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?br:F).attr("height",gt?F:Er);M.exit().remove()}}jo(a.data.targets).forEach(function(e){Vf[e]=true})}function rl(){nl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function il(){if(Uo(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Bf.altDomain){Ur.domain(Bf.altDomain);Bf.scale(Ur).updateScaleExtent();return}if(nr&&Ur.orgDomain()[0]===Wf[0]){Ur.domain([Wf[0]-1e-10,Ur.orgDomain()[1]])}nl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){or=true}}function sl(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function ol(){jf.attr("width",xr).attr("height",Tr);jf.select("#"+Kn).select("rect").attr("width",br).attr("height",Er);jf.select("#"+Qn).select("rect").attr("x",Hi).attr("y",Bi).attr("width",Ri).attr("height",Ui);jf.select("#"+Gn).select("rect").attr("x",ji).attr("y",Fi).attr("width",zi).attr("height",Wi);jf.select("."+n.zoomRect).attr("width",br).attr("height",Er);zf.style("max-height",Tr+"px")}function ul(e){return{axisX:e?Yr.x.transition().duration(e):Yr.x,axisY:e?Yr.y.transition().duration(e):Yr.y,axisY2:e?Yr.y2.transition().duration(e):Yr.y2,axisSubX:e?Yr.subx.transition().duration(e):Yr.subx}}function al(e){var t;e=e||{};e.withTransition=rf(e,"withTransition",true);e.withTransform=rf(e,"withTransform",false);e.withLegend=rf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=ul(e.withTransitionForAxis?k:0);yi();Gi();ol();di(e.withTransition,t)}nl(e,t)}function fl(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=If.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",wu);f=a.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",nu);s=If.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);i=s.enter().append("g").attr("class",Su).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",lu).style("cursor",function(e){return $(e)?"pointer":null});r=If.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);t=r.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",ou);t.append("g").attr("class",yu);t.append("g").attr("class",du);t.append("g").attr("class",function(e){return eu(n.selectedCircles,e.id)});t.append("g").attr("class",au).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){If.selectAll("."+n.selectedCircles+Tu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=If.select("."+n.chartArcs).selectAll("."+n.chartArc).data(Dr(e)).attr("class",xu);o=u.enter().append("g").attr("class",xu);o.append("g").attr("class",hu);o.append("text").attr("dy",Mn==="arc"?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",br/10+"px");if(Mn==="arc"){o.select("text").style("fill","#000");o.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",br/15+"px");o.append("text").attr("dx",-1*(kr+(Nr-kr)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px");o.append("text").attr("dx",kr+(Nr-kr)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px")}if(ot){p=qf.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);h=p.enter().append("g").style("opacity",0).attr("class",Su);h.append("g").attr("class",lu);c=qf.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);l=c.enter().append("g").style("opacity",0).attr("class",Eu);l.append("g").attr("class",ou);l.append("g").attr("class",yu);l.append("g").attr("class",du)}jf.selectAll("."+n.target).filter(function(e){return qo(e.id)}).transition().duration(k).style("opacity",1)}function ll(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?wa(e.id,t.types[e.id]):wa(e.id,t.type)})}a.data.targets.forEach(function(t){for(var n=0;n=v){v=o}if(!m||u>=m){m=u}c=ii?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});l=(f-c*e.length)/2;if(l"+(f||f===0?""+f+"":"")}c=e[a].name;l=o(e[a].value,e[a].ratio,e[a].id,e[a].index);h=Mn==="arc"&<?cr(e[a].value):i(e[a].id);u+="";u+=""+c+"";u+=""+l+"";u+=""}return u+""}),Vn=c(["tooltip","init","show"],false),$n=c(["tooltip","init","x"],0),Jn=c(["tooltip","init","position"],{top:"0px",left:"50px"});var Kn="c3-"+ +(new Date)+"-clip",Qn=Kn+"-xaxis",Gn=Kn+"-yaxis",Yn=fi(Kn),Zn=fi(Qn),er=fi(Gn);var tr=bt==="timeseries",nr=bt==="categorized",rr=!tr&&(L||Za(A));var ir=null,sr=false,or=false,ur=false,ar=false;var fr=u.scale.category10().range(),lr=Va(U,Za(at)?at:fr,R),cr=$a(at,lt);var hr=wt?u.time.format:u.time.format.utc,pr=hr.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&e.getDate()!==1}],["%-m/%-d",function(e){return e.getDate()!==1}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return true}]]);var dr=[],vr=[];var mr,gr,yr,br,wr,Er,Sr,xr,Tr;var Nr,Cr,kr,Lr,Ar,Or,Mr,_r,Dr;var Pr,Hr,Br,jr,Fr,Ir,qr,Rr;var Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr,Gr;var Yr={};var Zr=gt?"left":"bottom",ei=gt?Rt?"top":"bottom":Rt?"right":"left",ti=gt?Qt?"bottom":"top":Qt?"left":"right",ni=gt?"left":"bottom";var ri={main:function(){return"translate("+li(mr.left)+","+li(mr.top)+")"},context:function(){return"translate("+li(gr.left)+","+li(gr.top)+")"},legend:function(){return"translate("+yr.left+","+yr.top+")"},x:function(){return"translate(0,"+(gt?0:Er)+")"},y:function(){return"translate(0,"+(gt?Er:0)+")"},y2:function(){return"translate("+(gt?0:br)+","+(gt?1:0)+")"},subx:function(){return"translate(0,"+(gt?0:Sr)+")"},arc:function(){return"translate("+Lr/2+","+Ar/2+")"}};var ii=ht==="right";var si=0,oi=0,ui=0,ai=.15;var vi=30,mi=gt&&!yt?0:30,gi=5;Dr=u.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Hf,Bf=function(){};Hf=u.svg.brush().on("brush",rl);Hf.update=function(){if(qf){qf.select("."+n.brush).call(this)}return this};Hf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Bf=u.behavior.zoom().on("zoomstart",function(){Bf.altDomain=u.event.sourceEvent.altKey?Ur.orgDomain():null}).on("zoom",b?il:null);Bf.scale=function(e){return gt?this.y(e):this.x(e)};Bf.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Po()/e[1],e[1])]};Bf.updateScaleExtent=function(){var e=ao(Ur.orgDomain())/ao(Wf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var jf,Ff,If,qf,Rf,Uf,zf;var Wf;var Xf,Vf={};a.focus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(ka(a.data.targets)){$s(e,true)}vl(e,true)};a.defocus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",.3)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}vl(e,false)};a.revert=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}ml()};a.show=function(e,t){e=Fo(e);t=t||{};Vo(e);jf.selectAll(Cu(e)).transition().style("opacity",1);if(t.withLegend){gl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=Fo(e);t=t||{};Xo(e);jf.selectAll(Cu(e)).transition().style("opacity",0);if(t.withLegend){yl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){qo(e)?a.hide(e):a.show(e)};a.unzoom=function(){Hf.clear().update();nl({withUpdateXDomain:true})};a.load=function(e){if(e.xs){So(e.xs)}if("classes"in e){Object.keys(e.classes).forEach(function(t){D[t]=e.classes[t]})}if("categories"in e&&nr){Et=e.categories;Jr.categories(Et)}if("cacheIds"in e&&fo(e.cacheIds)){ll(co(e.cacheIds),e.done);return}if("unload"in e){hl(Fo(typeof e.unload==="boolean"&&e.unload?null:e.unload),function(){cl(e)})}else{cl(e)}};a.unload=function(e,t){hl(Fo(e),function(){nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t==="function"){t()}})};a.selected=function(e){return u.merge(If.selectAll("."+n.shapes+Tu(e)).selectAll("."+n.shape).filter(function(){return u.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){var t=e.__data__;return t.data?t.data:t})}))};a.select=function(e,t,r){if(!X){return}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,o){var a=u.select(this),f=i.data?i.data.id:i.id,l=df(this),c=V||!e||e.indexOf(f)>=0,h=!t||t.indexOf(o)>=0,p=a.classed(n.SELECTED);if(a.classed(n.line)||a.classed(n.area)){return}if(c&&h){if($(i)&&!p){l(true,a.classed(n.SELECTED,true),i,o)}}else if(s(r)&&r){if(p){l(false,a.classed(n.SELECTED,false),i,o)}}})};a.unselect=function(e,t){if(!X){return}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=df(this),f=V||!e||e.indexOf(o)>=0,l=!t||t.indexOf(i)>=0,c=s.classed(n.SELECTED);if(s.classed(n.line)||s.classed(n.area)){return}if(f&&l){if($(r)){if(c){a(false,s.classed(n.SELECTED,false),r,i)}}}})};a.toLine=function(e){xl(e,"line")};a.toSpline=function(e){xl(e,"spline")};a.toBar=function(e){xl(e,"bar")};a.toScatter=function(e){xl(e,"scatter")};a.toArea=function(e){xl(e,"area")};a.toAreaSpline=function(e){xl(e,"area-spline")};a.toPie=function(e){xl(e,"pie",{withTransform:true})};a.toDonut=function(e){xl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;nl();return P};a.xgrids=function(e){if(!e){return rn}rn=e;nl();return rn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(rn.concat(e))};a.xgrids.remove=function(e){var t=Sl(e);return a.xgrids(rn.filter(t))};a.ygrids=function(e){if(!e){return on}on=e;nl();return on};a.ygrids.add=function(e){if(!e){return}return a.ygrids(on.concat(e))};a.ygrids.remove=function(e){var t=Sl(e);return a.ygrids(on.filter(t))};a.regions=function(e){if(!e){return Rn}Rn=e;nl();return Rn};a.regions.add=function(e){if(!e){return Rn}Rn=Rn.concat(e);nl();return Rn};a.regions.remove=function(e){var t,r,i;e=e||{};t=rf(e,"duration",k);r=rf(e,"classes",[n.region]);i=If.select("."+n.regions).selectAll(r.map(function(e){return"."+e}));(t?i.transition().duration(t):i).style("opacity",0).remove();Rn=Rn.filter(function(e){var t=false;if(!e.class){return true}e.class.split(" ").forEach(function(e){if(r.indexOf(e)>=0){t=true}});return!t});return Rn};a.data.get=function(e){var t=a.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};a.data.getAsTarget=function(e){var t=a.data.targets.filter(function(t){return t.id===e});return t.length>0?t[0]:undefined};a.data.names=function(e){if(!arguments.length){return _}Object.keys(e).forEach(function(t){_[t]=e[t]});nl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});nl({withLegend:true});return U};a.x=function(e){if(arguments.length){No(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){Co(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){ls(t,e[t])});Fs()}};a.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Ot=+e.x}if(r(e.y)){jt=+e.y}if(r(e.y2)){Vt=+e.y2}}else{jt=Vt=+e}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Mt=+e.x}if(r(e.y)){Ft=+e.y}if(r(e.y2)){$t=+e.y2}}else{Ft=$t=+e}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){a.axis.max(e.max)}if(typeof e.min!=="undefined"){a.axis.min(e.min)}}};a.legend.show=function(e){gl(Fo(e));nl({withLegend:true})};a.legend.hide=function(e){yl(Fo(e));nl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;a.flush();a.flush()};a.flush=function(){al({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};zf.classed("c3",false).html("");e.onresize=null};if("url"in t.data){u.xhr(t.data.url,function(e,t){var n=u.csv.parseRows(t.response),r;if(n.length===1){r=[{}];n[0].forEach(function(e){r[0][e]=null})}else{r=u.csv.parse(t.response)}Jf(r)})}else if("rows"in t.data){Jf(Lo(t.data.rows))}else if("columns"in t.data){Jf(Ao(t.data.columns))}else{throw Error("url or rows or columns is required.")}return a};if(typeof define==="function"&&define.amd){define("c3",["d3"],t)}else if("undefined"!==typeof exports&&"undefined"!==typeof module){module.exports=t}else{e.c3=t}})(window) +(function(e){"use strict";function r(e){return e||e===0}function i(e){return typeof e==="undefined"}function s(e){return typeof e!=="undefined"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e=0;return"url("+(n?"":document.URL.split("#")[0])+"#"+t+")"}function fi(e){return Math.ceil(e)+.5}function li(e,t){var r,i,s;if(t&&t.axisX){r=t.axisX}else{r=Ff.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=Ff.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=Ff.select("."+n.axisY2);if(e){s=s.transition()}}Ff.attr("transform",ni.main);r.attr("transform",ni.x);i.attr("transform",ni.y);s.attr("transform",ni.y2);Ff.select("."+n.chartArcs).attr("transform",ni.arc)}function ci(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=If.select("."+n.axisX);if(e){r=r.transition()}}If.attr("transform",ni.context);r.attr("transform",ni.subx)}function hi(e){(e?qf.transition():qf).attr("transform",ni.legend)}function pi(e,t){li(e,t);if(ot){ci(e,t)}hi(e)}function gi(){var e=Ki(),t=Ji(),n=ri?0:e,r=Ca(a.data.targets),i=gt||r?0:Li("x"),s=ot&&!r?ut+i:0;Sr=Ei();xr=Si();if(gt){vr={top:Li("y2")+xi(),right:r?0:Ci(),bottom:Li("y")+n+Ti(),left:s+(r?0:Ni())};mr={top:vr.top,right:NaN,bottom:20+n,left:di}}else{vr={top:4+xi(),right:r?0:Ci(),bottom:i+s+n+Ti(),left:r?0:Ni()};mr={top:xr-s-n,right:NaN,bottom:i+n,left:vr.left}}gr={top:ri?0:xr-e,right:NaN,bottom:0,left:ri?Sr-t:0};yr=Sr-vr.left-vr.right;wr=xr-vr.top-vr.bottom;if(yr<0){yr=0}if(wr<0){wr=0}br=gt?vr.left-di-vi:yr;Er=gt?wr:xr-mr.top-mr.bottom;if(br<0){br=0}if(Er<0){Er=0}kr=yr-(ri?t+10:0);Lr=wr-(ri?0:10);bi();if(ri&&r){gr.left=kr/2+Nr*1.1}}function yi(){Ff.select("line."+n.xgridFocus).attr("x1",gt?0:-10).attr("x2",gt?yr:-10).attr("y1",gt?-10:vr.top).attr("y2",gt?-10:wr)}function bi(){Nr=Math.min(kr,Lr)/2;Tr=Nr*.95;var e=_n?(Tr-_n)/Tr:.6;Cr=Na(a.data.targets)||Ta(a.data.targets)?Tr*e:0}function wi(){var e=gt?n.axisX:n.axisY,t=Ff.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=Uf.node().getBoundingClientRect(),s=Ca(a.data.targets),o=r.right-i.left-(s?0:Ni());return o>0?o:0}function Ei(){return p?p:Oi()}function Si(){var e=d?d:Mi();return e>0?e:320}function xi(){return g?g:0}function Ti(){return y?y:0}function Ni(){if(v){return v}else if(gt){return!yt?1:Math.max(rf(ki("x")),40)}else{return!Bt||Rt?1:rf(ki("y"))}}function Ci(){var e=10,t=ri?Ji()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:rf(ki("y2")))+t}}function ki(e){var t=gs(e);return t.isInner?20+Bs(e):40+Bs(e)}function Li(e){if(e==="x"&&!yt){return 0}if(e==="x"&&Dt){return Dt}if(e==="y"&&!Bt){return ct&&!ri?10:1}if(e==="y2"&&!Xt){return mi}return(gs(e).isInner?30:40)+(e==="y2"?-10:0)}function Ai(e){var t=Uf.node(),n;while(t&&t.tagName!=="BODY"){n=t.getBoundingClientRect()[e];if(n){break}t=t.parentNode}return n}function Oi(){return Ai("width")}function Mi(){var e=Uf.style("height");return e.indexOf("px")>0?+e.replace("px",""):0}function _i(e){return e?-(1+30):-(vr.left-1)}function Di(e){return e?-20:-4}function Pi(){return _i(!gt)}function Hi(){return Di(!gt)}function Bi(){return _i(gt)}function ji(){return Di(gt)}function Fi(e){return e?yr+2+30+30:vr.left+20}function Ii(e){return e?(Dt?Dt:0)+80:wr+8}function qi(){return Fi(!gt)}function Ri(){return Ii(!gt)}function Ui(){return Fi(gt)}function zi(){return Ii(gt)}function Wi(){var e=Po(a.data.targets),t,n,r,i,s,o;if(!e){return 0}t=e.values[0],n=e.values[e.values.length-1];r=Rr(n.x)-Rr(t.x);if(r===0){return gt?wr:yr}i=Do();s=Ea(a.data.targets)?(i-(tr?.25:1))/i:1;o=i>1?r*s/(i-1):r;return o<1?1:o}function Xi(e){ii=e}function Vi(e){si=e}function $i(e){oi=e}function Ji(){return ct?ri?si*(ii+1):Sr:0}function Ki(){return ct?ri?xr:oi*(ii+1):0}function Qi(){var e,t,n=!Rr;Dr=gt?1:0;Pr=gt?wr:yr;Hr=gt?0:wr;Br=gt?yr:1;jr=Dr;Fr=Pr;Ir=gt?0:Er;qr=gt?br:1;Rr=Zi(Dr,Pr,n?undefined:Rr.domain(),function(){return $r.tickOffset()});Ur=es(Hr,Br,n?undefined:Ur.domain());zr=es(Hr,Br,n?undefined:zr.domain());Wr=Zi(Dr,Pr,zf,function(e){return e%1?0:Qr.tickOffset()});Xr=es(Ir,qr,n?undefined:Xr.domain());Vr=es(Ir,qr,n?undefined:Vr.domain());e=os();t=Lt?Lt:n?undefined:$r.tickValues();$r=rs(Rr,Yr,e,t);Qr=rs(Wr,ti,e,t);Jr=is(Ur,Zr,Ut,Wt);Kr=is(zr,ei,Gt,Zt);if(!n){Pf.scale(Wr);if(b){Hf.scale(Rr)}}Gi()}function Gi(){Ar=Is();Or=qs();Mr=qs(.98)}function Yi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function Zi(e,t,n,r){var i=Yi(e,t,er),s=n?i.domain(n):i,o;if(tr){r=r||function(){return 0};i=function(e,t){var n=s(e)+r(e);return t?n:Math.ceil(n)}}else{i=function(e,t){var n=s(e);return t?n:Math.ceil(n)}}for(o in s){i[o]=s[o]}i.orgDomain=function(){var e=s.domain();if(zf&&zf[0]===e[0]&&zf[1]=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}}function ds(){return ps("x",gt?"inner-top":"inner-right")}function vs(){return ps("y",gt?"inner-right":"inner-top")}function ms(){return ps("y2",gt?"inner-right":"inner-top")}function gs(e){return e==="y2"?ms():e==="y"?vs():ds()}function ys(){return as("x")}function bs(){return as("y")}function ws(){return as("y2")}function Es(e,t){if(e){return t.isLeft?0:t.isCenter?yr/2:yr}else{return t.isBottom?-wr:t.isMiddle?-wr/2:0}}function Ss(e,t){if(e){return t.isLeft?"0.5em":t.isRight?"-0.5em":"0"}else{return t.isTop?"-0.5em":t.isBottom?"0.5em":"0"}}function xs(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ts(){return Es(!gt,ds())}function Ns(){return Es(gt,vs())}function Cs(){return Es(gt,ms())}function ks(){return Ss(!gt,ds())}function Ls(){return Ss(gt,vs())}function As(){return Ss(gt,ms())}function Os(){var e=ds();if(gt){return e.isInner?"1.2em":-25-Bs("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function Ms(){var e=vs();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-Bs("y")}}function _s(){var e=ms();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+Bs("y2")}}function Ds(){return xs(!gt,ds())}function Ps(){return xs(gt,vs())}function Hs(){return xs(gt,ms())}function Bs(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;u.selectAll("."+r+" .tick text").each(function(){var e=this.getBoundingClientRect();if(ts?s:e.value)}return t?e:null}function Is(){var e=u.svg.arc().outerRadius(Tr).innerRadius(Cr),t=function(t,n){var r;if(n){return e(t)}r=Fs(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function qs(e){var t=u.svg.arc().outerRadius(Nr*(e?e:1)).innerRadius(Cr);return function(e){var n=Fs(e);return n?t(n):"M 0 0"}}function Rs(e,t){return Ba(e.data)?Ar(e,t):"M 0 0"}function Us(e){var t=Fs(e),n,r,i,s,o,u="";if(t){n=Ar.centroid(t);r=n[0];i=n[1];s=Math.sqrt(r*r+i*i);o=(36/Tr>.375?1.175-36/Tr:.8)*Tr/s;u=On=="arc"?"translate(1,1)":"translate("+r*o+","+i*o+")"}return u}function zs(e){var t=On=="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Ws(e){return xo({id:e.data.id,value:e.value,ratio:zs(e)})}function Xs(e){var t,n,r,i;if(!Js()){return""}t=Fs(e);n=t?t.value:null;r=zs(t);i=Ks();return i?i(n,r):Fu(n,r)}function Vs(e,t){var r=Bf.selectAll("."+n.chartArc+Tu(e)),i=Bf.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Wa(e)){r.selectAll("path").transition().duration(50).attr("d",Or).transition().duration(100).attr("d",Mr).each(function(e){if(Ha(e.data)){}})}if(!t){i.style("opacity",.3)}}function $s(e){var t=Bf.selectAll("."+n.chartArc+Tu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Ar);Bf.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Js(){if(Ta(a.data.targets)){return true}return Na(a.data.targets)?Dn:mn}function Ks(){if(Ta(a.data.targets)){return Tn}return Na(a.data.targets)?Pn:gn}function Qs(){return Na(a.data.targets)?Bn:""}function Gs(){if(Ta(a.data.targets)){return typeof kn==="function"?kn:function(){}}var e=Na(a.data.targets)?jn:bn;return typeof e==="function"?e:function(){}}function Ys(){if(Ta(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Na(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Zs(){if(Ta(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Na(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function eo(e){var t=Bo(e),n=Jo(e),r,i,s,o,a,f;if(P.length>0){f=Qo(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return u.min(Object.keys(n).map(function(e){return u.min(n[e])}))}function to(e){var t=Bo(e),n=Jo(e),r,i,s,o,a,f;if(P.length>0){f=Go(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?n/(i-1)/2:.5}else{s=n*.01}if(typeof _t==="object"&&Ya(_t)){o=r(_t.left)?_t.left:s;u=r(_t.right)?_t.right:s}else if(typeof _t==="number"){o=u=_t}else{o=u=s}return{left:o,right:u}}function oo(e){var t=[ro(e),io(e)],n=t[0],r=t[1],i=so(e),s=0,o=0;if(n-r===0&&!tr){n=er?new Date(n.getTime()*.5):-.5;r=er?new Date(r.getTime()*1.5):.5}if(n||n===0){s=er?new Date(n.getTime()-i.left):n-i.left}if(r||r===0){o=er?new Date(r.getTime()+i.right):r+i.right}return[s,o]}function uo(e){return e[1]-e[0]}function ao(e){for(var t=0;t=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r).map(function(e,n){return Co(e,t,n)})}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Ya(A)){a.data.xs[t]=bo(i,a.data.targets)}}else{a.data.xs[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!a.data.xs[e]){throw new Error('x is not defined for id = "'+e+'".')}});i=t.map(function(t,n){var r=M(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=yo(t),o=e[s],u=Co(o,t,i);if(nr&&tr&&n===0&&o){if(i===0){Et=[]}Et.push(o)}if(typeof e[t]==="undefined"||a.data.xs[t].length<=i){u=undefined}return{x:u,value:e[t]!==null&&!isNaN(e[t])?+e[t]:null,id:r}}).filter(function(e){return typeof e.x!=="undefined"})}});i.forEach(function(e){var t;e.values=e.values.sort(function(e,t){var n=e.x||e.x===0?e.x:Infinity,r=t.x||t.x===0?t.x:Infinity;return n-r});t=0;e.values.forEach(function(e){e.index=t++})});if(B){ba(Bo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){fo(e.id_org,e)});return i}function Oo(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}}function Mo(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function _o(e){return e1){e.forEach(function(e){if(e.values.length>n){r=e;n=e.values.length}})}else{r=t?e[0]:null}return r}function Ho(e){var t=Po(e),n,r;if(!t){return[0,0]}n=t.values[0],r=t.values[t.values.length-1];return[n.x,r.x]}function Bo(e){return e.map(function(e){return e.id})}function jo(e){return e?typeof e==="string"?[e]:e:Bo(a.data.targets)}function Fo(e,t){var n=Bo(e),r;for(r=0;r2){o=r-2;i=e[0];s=e[e.length-1];u=(s-i)/(o+1);n=[i];for(a=0;a0})}function Yo(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||e[i].x===0){f=f.concat(Wu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Wu(e,s))}return $u(f,t)}return Xu(e,t,i,s)}function Vu(e,t){var n;n=e.map(function(e){return Xu(e.values,t)});return $u(n,t)}function $u(e,t){var n,r;e.forEach(function(e){var i=ef(e,t);if(il){o-=u-l}if(f+i>Si()){f-=i+30}}Rf.style("top",f+"px").style("left",o+"px")}function ea(){Rf.style("display","none")}function ta(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Rn){return}if(Sa(a.data.targets)||Ca(a.data.targets)){return}var i=Ff.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",qu).attr(gt?"y2":"x2",qu);el(i,"grid")}function na(){Ff.select("line."+n.xgridFocus).style("visibility","hidden")}function ra(e,t){var r=[],i,s,o,u,a=Ff.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=oo();s=i[0].getFullYear();o=i[1].getFullYear();for(u=s;u<=o;u++){r.push(new Date(u+"-01-01 00:00:00"))}}else{r=t.ticks(10)}return r.slice(0,a)}function ia(e){return e.x||e.x===0?Rr(e.x):null}function sa(e,t){var n=va(),r=_f(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ts(e.id)(e.value)}function oa(){var e={},t=0,n,r;Ro(a.data.targets.filter(Ma)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function la(e,t){return typeof dn==="number"?dn:t?e.tickOffset()*2*vn/t:0}function ca(){var e={},t=0,n,r;Ro(a.data.targets.filter(Oa)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function va(){var e={},t=0,n,r;Ro(a.data.targets.filter(ka)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ba(e,t){jo(e).forEach(function(e){Xf[e]=t===j[e];j[e]=t});if(!e){B=t}}function wa(e,t){var n=false;e.forEach(function(e){if(j[e.id]===t){n=true}if(!(e.id in j)&&t==="line"){n=true}});return n}function Ea(e){return wa(e,"bar")}function Sa(e){return wa(e,"scatter")}function xa(e){return B==="pie"||wa(e,"pie")}function Ta(e){return wa(e,"gauge")}function Na(e){return B==="donut"||wa(e,"donut")}function Ca(e){return xa(e)||Na(e)||Ta(e)}function ka(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="line"||j[t]==="spline"||j[t]==="area"||j[t]==="area-spline"}function La(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Aa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function Ba(e){return Da(e)||Ha(e)||Pa(e)}function ja(e){return ka(e)?[e]:[]}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Ba(e.data)?[e]:[]}function qa(e){return Ma(e)?e.values:[]}function Ra(e){return ka(e)||_a(e)?e.values:[]}function Ua(e){return ka(e)||La(e)?[e]:[]}function za(e){return Ma(e)||ka(e)?e.values:[]}function Wa(e){return Ha(e)&&Hn||Da(e)&&yn}function Xa(e,t,n){var r=[];return function(i){var s=i.id||i,o;if(e[s]instanceof Function){o=e[s](i)}else if(e[s]){o=e[s]}else{if(r.indexOf(s)<0){r.push(s)}o=t[r.indexOf(s)%t.length]}return n instanceof Function?n(o,i):o}}function Va(e,t){var n=e,r=t;return function(e){for(var t=1;t0}function Za(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function ef(e,t){var n=ss(e.id)==="y"?Ur:zr,r=gt?1:0,i=gt?0:1;return Math.pow(Rr(e.x)-t[r],2)+Math.pow(n(e.value)-t[i],2)}function tf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function nf(e,t,n){return s(e[t])?e[t]:n}function rf(e){return Math.ceil(e/10)*10}function sf(e,t){var n;u.select("body").selectAll(".dummy").data([e]).enter().append("text").classed(t?t:"",true).text(e).each(function(){n=this.getBoundingClientRect()}).remove();return n}function of(e,t,r){Y(t,e.node());Ff.select("."+n.selectedCircles+xu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return Zo(n.selectedCircle,r)}).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa).attr("stroke",function(){return fr(t)}).attr("r",gf(t)*1.4).transition().duration(100).attr("r",gf)}function uf(e,t,r){Z(t,e.node());Ff.select("."+n.selectedCircles+xu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function af(e,t,n,r){e?of(t,n,r):uf(t,n,r)}function ff(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(fr(t)).brighter(.75)})}function lf(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return fr(t)})}function cf(e,t,n,r){e?ff(t,n,r):lf(t,n,r)}function hf(e,t,n,r){cf(e,t,n.data,r)}function pf(e){return e.nodeName==="circle"?af:u.select(e).classed(n.bar)?cf:hf}function df(e){return e.filter(function(e){return r(e.value)})}function vf(e){return un?typeof an==="function"?an(e):an:0}function mf(e){return ln?cn?cn:vf(e)*1.75:vf(e)}function gf(e){return hn?hn:vf(e)*4}function yf(e,t){return(t?Ff.selectAll("."+n.circles+xu(t)):Ff).selectAll("."+n.circle+(r(e)?"-"+e:""))}function bf(e,t){yf(e,t).classed(n.EXPANDED,true).attr("r",mf)}function wf(e){yf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",vf)}function Ef(e){return Ff.selectAll("."+n.bar+(r(e)?"-"+e:""))}function Sf(e){Ef(e).classed(n.EXPANDED,true)}function xf(e){Ef(e).classed(n.EXPANDED,false)}function Tf(e,t){var n,r=Of(e,t),i=t?ns:ts;if(gt){n=u.svg.area().x0(function(e,t){return i(e.id)(0)}).x1(function(e,t){return i(e.id)(e.value)}).y(qu)}else{n=u.svg.area().x(qu).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return i(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return i(e.id)(e.value)})}return function(e,t){var r=df(e.values),i,s;if(wa([e],"area")||wa([e],"area-spline")){Aa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(wa([e],"area-step")){La(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=Rr(r[0].x);s=ts(e.id)(r[0].value);return gt?"M "+s+" "+i:"M "+i+" "+s}}}function Nf(e,t){var n=_f(e,t),r=t?ns:ts,i=t?zu:qu,s=function(e,t){if(P.length>0){var i=n(e,t);return i[0][1]}return r(e.id)(e.value)},o=u.svg.line().x(gt?s:i).y(gt?i:s);if(!pn){o=o.defined(function(e){return e.value!=null})}return function(e){var n=pn?df(e.values):e.values,i=t?i:Wr,s=r(e.id),u=0,a=0;if(ka(e)){if(q[e.id]){return Df(n,i,s,q[e.id])}else{o.interpolate(Aa(e)?"cardinal":"linear");return o(n)}}else if(La(e)){o.interpolate("step-after");return o(n)}else{if(n[0]){u=i(n[0].x);a=s(n[0].value)}return gt?"M "+a+" "+u:"M "+u+" "+a}}}function Cf(e,t){var n=Mf(e,t);return function(e,t){var r=n(e,t);var i=gt?1:0;var s=gt?0:1;var o="M "+r[0][i]+","+r[0][s]+" "+"L"+r[1][i]+","+r[1][s]+" "+"L"+r[2][i]+","+r[2][s]+" "+"L"+r[3][i]+","+r[3][s]+" "+"z";return o}}function kf(e,t){var n=Mf(e,false),r=t?Lf:Af;return function(e,t){return r(n(e,t),e,this)}}function Lf(e,t){var n;if(gt){n=Ma(t)?4:6;return e[2][1]+n*(t.value<0?-1:1)}else{return e[0][0]+(e[2][0]-e[0][0])/2}}function Af(e,t,n){var r=n.getBoundingClientRect();if(gt){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:Ma(t)?-3:-6)}}function Of(e,t){var n=e.__max__+1,r=ha(n,e,!!t),i=pa(!!t),s=da(e,!!t),o=t?ns:ts;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function Mf(e,t){var n=e.__max__+1,r=la($r,n),i=ua(r,n,e,!!t),s=aa(!!t),o=fa(e,!!t),u=t?ns:ts;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(gt){if(00&&fu){f=u}}return[[a,f-(n-u)]]}}function Df(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m,g;var y,b;var w=[];if(s(r)){for(u=0;u=0){u.select(this).style("display",t%mt?"none":"block")}})}else{Bf.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){hs(Gr.x,t.axisX,At)}G=Tf(_,false);Z=Cf(D);tt=Nf(P,false);it=kf(D,true);st=kf(D,false);Xr.domain(Ur.domain());Vr.domain(zr.domain());Rf.style("display","none");yi();Ff.select("line."+n.xgridFocus).style("visibility","hidden");if(en){o=ra(tn,Rr);B=tr?$r.tickOffset():0;s=gt?{x1:0,x2:yr,y1:function(e){return Rr(e)-B},y2:function(e){return Rr(e)-B}}:{x1:function(e){return Rr(e)+B},x2:function(e){return Rr(e)+B},y1:vr.top,y2:wr};i=Ff.select("."+n.xgrids).selectAll("."+n.xgrid).data(o);i.enter().append("line").attr("class",n.xgrid);i.attr(s).style("opacity",function(){return+u.select(this).attr(gt?"y1":"x1")===(gt?wr:0)?0:1});i.exit().remove()}if(Ya(nn)){f=Ff.select("."+n.xgridLines).selectAll("."+n.xgridLine).data(nn);l=f.enter().append("g").attr("class",function(e){return n.xgridLine+(e.class?e.class:"")});l.append("line").style("opacity",0);l.append("text").attr("text-anchor","end").attr("transform",gt?"":"rotate(-90)").attr("dx",gt?0:-vr.top).attr("dy",-5).style("opacity",0);f.select("line").transition().duration(ut).attr("x1",gt?0:Ru).attr("x2",gt?yr:Ru).attr("y1",gt?Ru:vr.top).attr("y2",gt?Ru:wr).style("opacity",1);f.select("text").transition().duration(ut).attr("x",gt?yr:0).attr("y",Ru).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(ut).style("opacity",0).remove()}if(I&&rn){c=Ff.select("."+n.ygrids).selectAll("."+n.ygrid).data(Ur.ticks(on));c.enter().append("line").attr("class",n.ygrid);c.attr("x1",gt?Ur:0).attr("x2",gt?Ur:yr).attr("y1",gt?0:Ur).attr("y2",gt?wr:Ur);c.exit().remove();el(c,"grid")}if(I&&Ya(sn)){h=Ff.select("."+n.ygridLines).selectAll("."+n.ygridLine).data(sn);p=h.enter().append("g").attr("class",function(e){return n.ygridLine+(e.class?e.class:"")});p.append("line").style("opacity",0);p.append("text").attr("text-anchor","end").attr("transform",gt?"rotate(-90)":"").attr("dx",gt?0:-vr.top).attr("dy",-5).style("opacity",0);h.select("line").transition().duration(ut).attr("x1",gt?Uu:0).attr("x2",gt?Uu:yr).attr("y1",gt?0:Uu).attr("y2",gt?wr:Uu).style("opacity",1);h.select("text").transition().duration(ut).attr("x",gt?0:yr).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(ut).style("opacity",0).remove()}E=Ff.select("."+n.regions).selectAll("."+n.region).data(qn);E.enter().append("g").attr("class",du).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(ut).attr("x",co).attr("y",ho).attr("width",po).attr("height",vo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(ut).style("opacity",0).remove();y=Ff.selectAll("."+n.bars).selectAll("."+n.bar).data(qa);y.enter().append("path").attr("class",au).style("stroke",function(e){return fr(e.id)}).style("stroke-width",2).style("opacity",0).style("fill",function(e){return fr(e.id)}).style("fill-opacity",function(){if(ft){return ft}return Lu});y.style("opacity",Lu).transition().duration(ut).attr("d",Z).style("fill",fr).style("opacity",1);y.exit().transition().duration(at).style("opacity",0).remove();d=Ff.selectAll("."+n.lines).selectAll("."+n.line).data(ja);d.enter().append("path").attr("class",iu).style("stroke",fr);d.style("opacity",Lu).transition().duration(ut).attr("d",tt).style("stroke",fr).style("opacity",1);d.exit().transition().duration(at).style("opacity",0).remove();v=Ff.selectAll("."+n.steps).selectAll("."+n.step).data(Fa);v.enter().append("path").attr("class",mu).style("stroke",fr);v.style("opacity",Lu).transition().duration(ut).attr("d",tt).style("stroke",fr).style("opacity",1);v.exit().transition().duration(at).style("opacity",0).remove();m=Ff.selectAll("."+n.areas).selectAll("."+n.area).data(Ua);m.enter().append("path").attr("class",hu).style("fill",fr).style("opacity",function(){Wf=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(ut).attr("d",G).style("fill",fr).style("opacity",Wf);m.exit().transition().duration(at).style("opacity",0).remove();if(un){g=Ff.selectAll("."+n.circles).selectAll("."+n.circle).data(Ra);g.enter().append("circle").attr("class",ou).attr("r",vf).style("fill",fr);g.style("opacity",Lu).transition().duration(ut).style("opacity",Ou).style("fill",fr).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa);g.exit().remove()}if(_u()){x=Ff.selectAll("."+n.texts).selectAll("."+n.text).data(za);x.enter().append("text").attr("class",eu).attr("text-anchor",function(e){return gt?e.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",fr).style("fill-opacity",0);x.text(function(e){return Iu(e.id)(e.value,e.id)}).style("fill-opacity",Au).transition().duration(ut).attr("x",it).attr("y",st).style("fill",fr).style("fill-opacity",Mu);x.exit().transition().duration(at).style("fill-opacity",0).remove()}w=Ff.selectAll("."+n.arcs).selectAll("."+n.arc).data(Ia);if(On==="arc"){w.enter().append("path").attr("class","").style("opacity",1).style("fill",Sn).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(e){e.value=Nn;e.startAngle=-1*(Math.PI/2);e.endAngle=Math.PI/2;return Rs(e,true)});w.exit().transition().duration(at).style("opacity",0).remove()}w.enter().append("path").attr("class",lu).style("fill",function(e){return fr(e.data)}).style("cursor",function(e){return $(e)?"pointer":null}).style("opacity",0).each(function(e){this._current=e}).on("mouseover",function(e,t){var n,r,i;if(ur){return}n=Fs(e);r=Ws(n);i=Ys();Vs(n.data.id);dl(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Fs(e),n=Ws(t),r=[n];Zu(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ur){return}n=Fs(e);r=Ws(n);i=Zs();$s(n.data.id);vl();ea();i(r,t)}).on("click",function(e,t){var n=Fs(e),r=Ws(n),i=Gs();Qf(this,e,t);i(r,t)});w.attr("transform",W?"scale(0)":"").style("opacity",function(e){return e===this._current?0:1}).each(function(){ur=true}).transition().duration(ut).attrTween("d",function(e){var t=Fs(e),n;if(!t){return function(){return"M 0 0"}}if(isNaN(this._current.endAngle))this._current.endAngle=this._current.startAngle;n=u.interpolate(this._current,t);this._current=n(0);return function(e){return Rs(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return On==="arc"&<?lr(e.data.values[0].value):fr(e.data.id)}).style("opacity",ft?ft:1).call(tf,function(){ur=false});w.exit().transition().duration(at).style("opacity",0).remove();Ff.selectAll("."+n.chartArc).select("text").style("opacity",0).text(Xs).attr("transform",Us).transition().duration(ut).style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});if(On==="arc"){Ff.selectAll("."+n.chartArc).select("text.units").attr("transform",Us).style("opacity",0).transition().duration(ut).text(xn?Mn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});Ff.selectAll("."+n.chartArc).select("text.min").attr("transform",Us).style("opacity",0).transition().duration(ut).text(xn?Cn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});Ff.selectAll("."+n.chartArc).select("text.max").attr("transform",Us).style("opacity",0).transition().duration(ut).text(xn?Nn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0})}Ff.select("."+n.chartArcsTitle).style("opacity",Na(a.data.targets)||Ta(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){Pf.extent(Rr.orgDomain()).update()}if(q){if(!gt&&At){hs(Gr.subx,t.axisSubX,At)}if(!Pf.empty()){Pf.extent(Rr.orgDomain()).update()}Y=Tf(_,true);et=Cf(D,true);rt=Nf(P,true);L=If.selectAll("."+n.bars).selectAll("."+n.bar).data(qa);L.enter().append("path").attr("class",au).style("stroke","none").style("fill",fr);L.style("opacity",Lu).transition().duration(ut).attr("d",et).style("opacity",1);L.exit().transition().duration(ut).style("opacity",0).remove();T=If.selectAll("."+n.lines).selectAll("."+n.line).data(ja);T.enter().append("path").attr("class",iu).style("stroke",fr);T.style("opacity",Lu).transition().duration(ut).attr("d",rt).style("opacity",1);T.exit().transition().duration(ut).style("opacity",0).remove();N=If.selectAll("."+n.steps).selectAll("."+n.step).data(Fa);N.enter().append("path").attr("class",iu).style("stroke",fr);N.style("opacity",Lu).transition().duration(ut).attr("d",rt).style("opacity",1);N.exit().transition().duration(ut).style("opacity",0).remove();C=If.selectAll("."+n.areas).selectAll("."+n.area).data(La?Fa:ja);C.enter().append("path").attr("class",hu).style("fill",fr).style("opacity",function(){Wf=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(ut).attr("d",Y).style("fill",fr).style("opacity",Wf);C.exit().transition().duration(at).style("opacity",0).remove()}}Ff.selectAll("."+n.selectedCircles).filter(function(e){return Ma(e)}).selectAll("circle").remove();Ff.selectAll("."+n.selectedCircle).transition().duration(ut).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa);if(S){O=Ff.select("."+n.eventRects);if(Ya(A)&&!So(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=Ff.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Kf(M.enter());M.attr("x",0).attr("y",0).attr("width",yr).attr("height",wr)}else{if(!O.classed(n.eventRectsSingle)){O.classed(n.eventRectsMultiple,false).classed(n.eventRectsSingle,true).selectAll("."+n.eventRect).remove()}if((nr||er)&&!tr){F=function(e,t){var n=Mo(t),r=_o(t),i=a.data.xs[e.id][t];var s=Rr(r?r:i);var o=Rr(n?n:i);return(s-o)/2};j=function(e,t){var n=Mo(t),r=a.data.xs[e.id][t];return(Rr(r)+Rr(n?n:r))/2}}else{F=Wi();j=function(e){return Rr(e.x)-F/2}}H=Po(a.data.targets);Ff.select("."+n.eventRects).datum(H?H.values:[]);M=Ff.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Jf(M.enter());M.attr("class",vu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?yr:F).attr("height",gt?F:wr);M.exit().remove()}}Bo(a.data.targets).forEach(function(e){Xf[e]=true})}function nl(){tl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function rl(){if(Ro(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Hf.altDomain){Rr.domain(Hf.altDomain);Hf.scale(Rr).updateScaleExtent();return}if(tr&&Rr.orgDomain()[0]===zf[0]){Rr.domain([zf[0]-1e-10,Rr.orgDomain()[1]])}tl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){sr=true}}function il(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function sl(){Bf.attr("width",Sr).attr("height",xr);Bf.select("#"+Jn).select("rect").attr("width",yr).attr("height",wr);Bf.select("#"+Kn).select("rect").attr("x",Pi).attr("y",Hi).attr("width",qi).attr("height",Ri);Bf.select("#"+Qn).select("rect").attr("x",Bi).attr("y",ji).attr("width",Ui).attr("height",zi);Bf.select("."+n.zoomRect).attr("width",yr).attr("height",wr);Uf.style("max-height",xr+"px")}function ol(e){return{axisX:e?Gr.x.transition().duration(e):Gr.x,axisY:e?Gr.y.transition().duration(e):Gr.y,axisY2:e?Gr.y2.transition().duration(e):Gr.y2,axisSubX:e?Gr.subx.transition().duration(e):Gr.subx}}function ul(e){var t;e=e||{};e.withTransition=nf(e,"withTransition",true);e.withTransform=nf(e,"withTransform",false);e.withLegend=nf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=ol(e.withTransitionForAxis?k:0);gi();Qi();sl();pi(e.withTransition,t)}tl(e,t)}function al(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=Ff.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",bu);f=a.enter().append("g").attr("class",bu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",tu);s=Ff.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Eu);i=s.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",fu).style("cursor",function(e){return $(e)?"pointer":null});r=Ff.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",wu);t=r.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",su);t.append("g").attr("class",gu);t.append("g").attr("class",pu);t.append("g").attr("class",function(e){return Zo(n.selectedCircles,e.id)});t.append("g").attr("class",uu).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){Ff.selectAll("."+n.selectedCircles+xu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=Ff.select("."+n.chartArcs).selectAll("."+n.chartArc).data(_r(e)).attr("class",Su);o=u.enter().append("g").attr("class",Su);o.append("g").attr("class",cu);o.append("text").attr("dy",On==="arc"?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",yr/10+"px");if(On==="arc"){o.select("text").style("fill","#000");o.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",yr/15+"px");o.append("text").attr("dx",-1*(Cr+(Tr-Cr)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",yr/20+"px");o.append("text").attr("dx",Cr+(Tr-Cr)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",yr/20+"px")}if(ot){p=If.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Eu);h=p.enter().append("g").style("opacity",0).attr("class",Eu);h.append("g").attr("class",fu);c=If.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",wu);l=c.enter().append("g").style("opacity",0).attr("class",wu);l.append("g").attr("class",su);l.append("g").attr("class",gu);l.append("g").attr("class",pu)}Bf.selectAll("."+n.target).filter(function(e){return Io(e.id)}).transition().duration(k).style("opacity",1)}function fl(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?ba(e.id,t.types[e.id]):ba(e.id,t.type)})}a.data.targets.forEach(function(t){for(var n=0;n=v){v=o}if(!m||u>=m){m=u}c=ri?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});l=(f-c*e.length)/2;if(l"+(f||f===0?""+f+"":"")}c=e[a].name;l=o(e[a].value,e[a].ratio,e[a].id,e[a].index);h=On==="arc"&<?lr(e[a].value):i(e[a].id);u+="";u+=""+c+"";u+=""+l+"";u+=""}return u+""}),Xn=c(["tooltip","init","show"],false),Vn=c(["tooltip","init","x"],0),$n=c(["tooltip","init","position"],{top:"0px",left:"50px"});var Jn="c3-"+ +(new Date)+"-clip",Kn=Jn+"-xaxis",Qn=Jn+"-yaxis",Gn=ai(Jn),Yn=ai(Kn),Zn=ai(Qn);var er=bt==="timeseries",tr=bt==="categorized",nr=!er&&(L||Ya(A));var rr=null,ir=false,sr=false,or=false,ur=false;var ar=u.scale.category10().range(),fr=Xa(U,Ya(at)?at:ar,R),lr=Va(at,lt);var cr=wt?u.time.format:u.time.format.utc,hr=cr.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&e.getDate()!==1}],["%-m/%-d",function(e){return e.getDate()!==1}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return true}]]);var pr=[],dr=[];var vr,mr,gr,yr,br,wr,Er,Sr,xr;var Tr,Nr,Cr,kr,Lr,Ar,Or,Mr,_r;var Dr,Pr,Hr,Br,jr,Fr,Ir,qr;var Rr,Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr;var Gr={};var Yr=gt?"left":"bottom",Zr=gt?Rt?"top":"bottom":Rt?"right":"left",ei=gt?Qt?"bottom":"top":Qt?"left":"right",ti=gt?"left":"bottom";var ni={main:function(){return"translate("+fi(vr.left)+","+fi(vr.top)+")"},context:function(){return"translate("+fi(mr.left)+","+fi(mr.top)+")"},legend:function(){return"translate("+gr.left+","+gr.top+")"},x:function(){return"translate(0,"+(gt?0:wr)+")"},y:function(){return"translate(0,"+(gt?wr:0)+")"},y2:function(){return"translate("+(gt?0:yr)+","+(gt?1:0)+")"},subx:function(){return"translate(0,"+(gt?0:Er)+")"},arc:function(){return"translate("+kr/2+","+Lr/2+")"}};var ri=ht==="right";var ii=0,si=0,oi=0,ui=.15;var di=30,vi=gt&&!yt?0:30,mi=5;_r=u.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Pf,Hf=function(){};Pf=u.svg.brush().on("brush",nl);Pf.update=function(){if(If){If.select("."+n.brush).call(this)}return this};Pf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Hf=u.behavior.zoom().on("zoomstart",function(){Hf.altDomain=u.event.sourceEvent.altKey?Rr.orgDomain():null}).on("zoom",b?rl:null);Hf.scale=function(e){return gt?this.y(e):this.x(e)};Hf.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Do()/e[1],e[1])]};Hf.updateScaleExtent=function(){var e=uo(Rr.orgDomain())/uo(zf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var Bf,jf,Ff,If,qf,Rf,Uf;var zf;var Wf,Xf={};a.focus=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",1)}var t=Bf.selectAll(Tu(e)),r=t.filter(bl),i=t.filter(wl);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(Ca(a.data.targets)){Vs(e,true)}dl(e,true)};a.defocus=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",.3)}var t=Bf.selectAll(Tu(e)),r=t.filter(bl),i=t.filter(wl);a.revert();s(r.classed(n.focused,false));s(i);if(Ca(a.data.targets)){$s(e)}dl(e,false)};a.revert=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",1)}var t=Bf.selectAll(Tu(e)),r=t.filter(bl),i=t.filter(wl);s(r.classed(n.focused,false));s(i);if(Ca(a.data.targets)){$s(e)}vl()};a.show=function(e,t){e=jo(e);t=t||{};Xo(e);Bf.selectAll(Nu(e)).transition().style("opacity",1);if(t.withLegend){ml(e)}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=jo(e);t=t||{};Wo(e);Bf.selectAll(Nu(e)).transition().style("opacity",0);if(t.withLegend){gl(e)}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){Io(e)?a.hide(e):a.show(e)};a.unzoom=function(){Pf.clear().update();tl({withUpdateXDomain:true})};a.load=function(e){if(e.xs){Eo(e.xs)}if("classes"in e){Object.keys(e.classes).forEach(function(t){D[t]=e.classes[t]})}if("categories"in e&&tr){Et=e.categories;$r.categories(Et)}if("cacheIds"in e&&ao(e.cacheIds)){fl(lo(e.cacheIds),e.done);return}if("unload"in e){cl(jo(typeof e.unload==="boolean"&&e.unload?null:e.unload),function(){ll(e)})}else{ll(e)}};a.unload=function(e,t){cl(jo(e),function(){tl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t==="function"){t()}})};a.selected=function(e){return u.merge(Ff.selectAll("."+n.shapes+xu(e)).selectAll("."+n.shape).filter(function(){return u.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){var t=e.__data__;return t.data?t.data:t})}))};a.select=function(e,t,r){if(!X){return}Ff.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,o){var a=u.select(this),f=i.data?i.data.id:i.id,l=pf(this),c=V||!e||e.indexOf(f)>=0,h=!t||t.indexOf(o)>=0,p=a.classed(n.SELECTED);if(a.classed(n.line)||a.classed(n.area)){return}if(c&&h){if($(i)&&!p){l(true,a.classed(n.SELECTED,true),i,o)}}else if(s(r)&&r){if(p){l(false,a.classed(n.SELECTED,false),i,o)}}})};a.unselect=function(e,t){if(!X){return}Ff.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=pf(this),f=V||!e||e.indexOf(o)>=0,l=!t||t.indexOf(i)>=0,c=s.classed(n.SELECTED);if(s.classed(n.line)||s.classed(n.area)){return}if(f&&l){if($(r)){if(c){a(false,s.classed(n.SELECTED,false),r,i)}}}})};a.toLine=function(e){Sl(e,"line")};a.toSpline=function(e){Sl(e,"spline")};a.toBar=function(e){Sl(e,"bar")};a.toScatter=function(e){Sl(e,"scatter")};a.toArea=function(e){Sl(e,"area")};a.toAreaSpline=function(e){Sl(e,"area-spline")};a.toPie=function(e){Sl(e,"pie",{withTransform:true})};a.toDonut=function(e){Sl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;tl();return P};a.xgrids=function(e){if(!e){return nn}nn=e;tl();return nn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(nn.concat(e))};a.xgrids.remove=function(e){var t=El(e);return a.xgrids(nn.filter(t))};a.ygrids=function(e){if(!e){return sn}sn=e;tl();return sn};a.ygrids.add=function(e){if(!e){return}return a.ygrids(sn.concat(e))};a.ygrids.remove=function(e){var t=El(e);return a.ygrids(sn.filter(t))};a.regions=function(e){if(!e){return qn}qn=e;tl();return qn};a.regions.add=function(e){if(!e){return qn}qn=qn.concat(e);tl();return qn};a.regions.remove=function(e){var t,r,i;e=e||{};t=nf(e,"duration",k);r=nf(e,"classes",[n.region]);i=Ff.select("."+n.regions).selectAll(r.map(function(e){return"."+e}));(t?i.transition().duration(t):i).style("opacity",0).remove();qn=qn.filter(function(e){var t=false;if(!e.class){return true}e.class.split(" ").forEach(function(e){if(r.indexOf(e)>=0){t=true}});return!t});return qn};a.data.get=function(e){var t=a.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};a.data.getAsTarget=function(e){var t=a.data.targets.filter(function(t){return t.id===e});return t.length>0?t[0]:undefined};a.data.names=function(e){if(!arguments.length){return _}Object.keys(e).forEach(function(t){_[t]=e[t]});tl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});tl({withLegend:true});return U};a.x=function(e){if(arguments.length){To(a.data.targets,e);tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){No(a.data.targets,e);tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){fs(t,e[t])});js()}};a.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Ot=+e.x}if(r(e.y)){jt=+e.y}if(r(e.y2)){Vt=+e.y2}}else{jt=Vt=+e}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Mt=+e.x}if(r(e.y)){Ft=+e.y}if(r(e.y2)){$t=+e.y2}}else{Ft=$t=+e}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){a.axis.max(e.max)}if(typeof e.min!=="undefined"){a.axis.min(e.min)}}};a.legend.show=function(e){ml(jo(e));tl({withLegend:true})};a.legend.hide=function(e){gl(jo(e));tl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;a.flush();a.flush()};a.flush=function(){ul({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};Uf.classed("c3",false).html("");e.onresize=null};if("url"in t.data){u.xhr(t.data.url,function(e,t){var n=u.csv.parseRows(t.response),r;if(n.length===1){r=[{}];n[0].forEach(function(e){r[0][e]=null})}else{r=u.csv.parse(t.response)}$f(r)})}else if("rows"in t.data){$f(ko(t.data.rows))}else if("columns"in t.data){$f(Lo(t.data.columns))}else{throw Error("url or rows or columns is required.")}return a};if(typeof define==="function"&&define.amd){define("c3",["d3"],t)}else if("undefined"!==typeof exports&&"undefined"!==typeof module){module.exports=t}else{e.c3=t}})(window)