diff --git a/c3.js b/c3.js index 6a35827..e0fcc27 100644 --- a/c3.js +++ b/c3.js @@ -4674,6 +4674,27 @@ redraw({withUpdateXDomain: true}); }; + // For passing the configuration you want to update. + c3.update = function (keys, value) { + var target = config, i, isLast, nextTarget; + + for (i = 0; i < keys.length; i++) { + isLast = (i === keys.length - 1); + nextTarget = target[keys[i]]; + if (isLast) { + if (target[keys[i]] === undefined) { + target[keys[i]] = ''; + } + target[keys[i]] = value; + } else { + target = nextTarget; + } + } + + // Don't have a way to set the __variables without regenerating. + return parent.c3.generate(config); + }; + c3.load = function (args) { // update xs if specified if (args.xs) { diff --git a/c3.min.js b/c3.min.js index 1b64625..dbb0feb 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 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(tr?r: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){return i(e.id)(0)}).x1(function(e){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){var t=df(e.values),r,i;if(wa([e],"area")||wa([e],"area-spline")){Aa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(t)}else if(wa([e],"area-step")){La(e)?n.interpolate("step-after"):n.interpolate("linear");return n(t)}else{r=Rr(t[0].x);i=ts(e.id)(t[0].value);return gt?"M "+i+" "+r:"M "+r+" "+i}}}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) +(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(tr?r: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){return i(e.id)(0)}).x1(function(e){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){var t=df(e.values),r,i;if(wa([e],"area")||wa([e],"area-spline")){Aa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(t)}else if(wa([e],"area-step")){La(e)?n.interpolate("step-after"):n.interpolate("linear");return n(t)}else{r=Rr(t[0].x);i=ts(e.id)(t[0].value);return gt?"M "+i+" "+r:"M "+r+" "+i}}}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.update=function(e,n){var r=t,i,s,o;for(i=0;i=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) diff --git a/htdocs/index.html b/htdocs/index.html index 64e3044..e75bf57 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -44,7 +44,7 @@

Specify Axis Min/Max Values

You can specify your own min/max values for each axis.

View details »

- + @@ -108,6 +108,11 @@

Display as Bar Chart

View details »

+
+

Arc Gauge

+

Display as Arc Gauge

+

View details »

+
diff --git a/htdocs/samples/chart_arc_gauge.html b/htdocs/samples/chart_arc_gauge.html new file mode 100644 index 0000000..51cb870 --- /dev/null +++ b/htdocs/samples/chart_arc_gauge.html @@ -0,0 +1,140 @@ + + + + + +
+ + + + + +