diff --git a/c3.js b/c3.js index bb7d692..22dc60a 100644 --- a/c3.js +++ b/c3.js @@ -946,7 +946,6 @@ if (! found && t.data.id === d.data.id) { found = true; d = t; - return; } }); return found ? d : null; diff --git a/c3.min.js b/c3.min.js index 3c1b932..4467a38 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Dj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Dj.select("."+g.axisY2),a&&(e=e.transition())),Dj.attr("transform",nj.main),c.attr("transform",nj.x),d.attr("transform",nj.y),e.attr("transform",nj.y2),Dj.select("."+g.chartArcs).attr("transform",nj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Ej.select("."+g.axisX),a&&(c=c.transition())),Ej.attr("transform",nj.context),c.attr("transform",nj.subx)}function n(a){(a?Fj.transition():Fj).attr("transform",nj.legend)}function o(a,b){l(a,b),oh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=oj?0:a,d=le(Of.data.targets),e=xh||d?0:A("x"),f=oh&&!d?ph+e:0;lg=t(),mg=u(),xh?(eg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},fg={top:eg.top,right:0/0,bottom:20+c,left:tj}):(eg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},fg={top:mg-f-c,right:0/0,bottom:e+c,left:eg.left}),gg={top:oj?0:mg-a,right:0/0,bottom:0,left:oj?lg-b:0},hg=lg-eg.left-eg.right,jg=mg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),ig=xh?eg.left-tj-uj:hg,kg=xh?jg:mg-fg.top-fg.bottom,0>ig&&(ig=0),0>kg&&(kg=0),qg=hg-(oj?b+10:0),rg=jg-(oj?0:10),r(),oj&&d&&(gg.left=qg/2+1.1*og)}function q(){Dj.select("line."+g.xgridFocus).attr("x1",xh?0:-10).attr("x2",xh?hg:-10).attr("y1",xh?-10:eg.top).attr("y2",xh?-10:jg)}function r(){og=Math.min(qg,rg)/2,ng=.95*og,pg=ke(Of.data.targets)?.6*ng:0}function s(){var a=xh?g.axisX:g.axisY,b=Dj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hj.node().getBoundingClientRect(),e=le(Of.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Rf?Rf:B()}function u(){var a=Sf?Sf:C();return a>0?a:320}function v(){return Vf?Vf:0}function w(){return Wf?Wf:0}function x(){return Tf?Tf:xh?yh?Math.max(Ke(z("x")),40):1:!Qh||Vh?1:Ke(z("y"))}function y(){var a=10,b=oj?T()+20:0;return Uf?Uf:xh?a+b:(!Zh||ci?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||yh?"x"===a&&Nh?Nh:"y"!==a||Qh?"y2"!==a||Zh?(ob(a).isInner?30:40)+("y2"===a?-10:0):vj:rh&&!oj?10:1:0}function B(){return+Hj.style("width").replace("px","")}function C(){return+Hj.style("height").replace("px","")}function D(a){return a?-31:-(eg.left-1)}function E(a){return a?-20:-4}function F(){return D(!xh)}function G(){return E(!xh)}function H(){return D(xh)}function I(){return E(xh)}function J(a){return a?hg+2+30+30:eg.left+20}function K(a){return a?(Nh?Nh:0)+80:jg+8}function L(){return J(!xh)}function M(){return K(!xh)}function N(){return J(xh)}function O(){return K(xh)}function P(){var a,b,c,d,e,f=Ec(Of.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Eg(b.x)-Eg(a.x),0===c?xh?jg:hg:(d=Dc(),e=he(Of.data.targets)?(d-(Xi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){pj=a}function R(a){qj=a}function S(a){rj=a}function T(){return rh?oj?qj*(pj+1):lg:0}function U(){return rh?oj?mg:rj*(pj+1):0}function V(){var a,b,c=!Eg;wg=xh?1:0,xg=xh?jg:hg,yg=xh?0:jg,zg=xh?hg:1,Ag=wg,Bg=xg,Cg=xh?0:kg,Dg=xh?ig:1,Eg=Y(wg,xg,c?void 0:Eg.domain(),function(){return Kg.tickOffset()}),Fg=Z(yg,zg,c?void 0:Fg.domain()),Gg=Z(yg,zg,c?void 0:Gg.domain()),Hg=Y(wg,xg,Ij,function(a){return a%1?0:Ng.tickOffset()}),Ig=Z(Cg,Dg,c?void 0:Ig.domain()),Jg=Z(Cg,Dg,c?void 0:Jg.domain()),a=db(),b=Ih?Ih:c?void 0:Kg.tickValues(),Kg=ab(Eg,jj,a,b),Ng=ab(Hg,mj,a,b),Lg=bb(Fg,kj,Wh,Yh),Mg=bb(Gg,lj,di,fi),c||(wj.scale(Hg),Xf&&Aj.scale(Eg)),W()}function W(){sg=Kb(),tg=Lb(),ug=Lb(.98)}function X(a,b,c){return(c?Nf.time.scale():Nf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Wi),g=c?f.domain(c):f;Xi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Ij&&Ij[0]===a[0]&&Ij[1]a?a.toFixed(0):a};return Dh&&("function"==typeof Dh?a=Dh:Wi&&(a=function(a){return a?ej(Dh)(a):""})),a}function eb(a){var b;return"y"===a?b=Uh:"y2"===a?b=bi:"x"===a&&(b=Ph),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Uh=b:"y2"===a?bi=b:"x"===a&&(Ph=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function lb(){return kb("x",xh?"inner-top":"inner-right")}function mb(){return kb("y",xh?"inner-right":"inner-top")}function nb(){return kb("y2",xh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?hg/2:hg:b.isBottom?-jg:b.isMiddle?-jg/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!xh,lb())}function wb(){return sb(xh,mb())}function xb(){return sb(xh,nb())}function yb(){return tb(!xh,lb())}function zb(){return tb(xh,mb())}function Ab(){return tb(xh,nb())}function Bb(){var a=lb();return xh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Nh?Nh-10:"3em"}function Cb(){var a=mb();return xh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return xh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!xh,lb())}function Fb(){return ub(xh,mb())}function Gb(){return ub(xh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Dj.select("."+g.axisX+" ."+g.axisXLabel),c=Dj.select("."+g.axisY+" ."+g.axisYLabel),d=Dj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return vg(Lc(Of.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Nf.svg.arc().outerRadius(ng).innerRadius(pg),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Nf.svg.arc().outerRadius(og*(a?a:1)).innerRadius(pg);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?sg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=sg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ng*.8+","+d/e*ng*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Bj.selectAll("."+g.chartArc+sd(a)),d=Bj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",tg).transition().duration(100).attr("d",ug).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Bj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",sg),Bj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Of.data.targets)?Bi:vi}function Ub(){return ke(Of.data.targets)?Ci:wi}function Vb(){return ke(Of.data.targets)?Ei:""}function Wb(){var a=ke(Of.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Of.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Of.data.targets)?Hi:Ai;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Ug.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Nf.min(Object.keys(i).map(function(a){return Nf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Ug.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Nf.max(Object.keys(i).map(function(a){return Nf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?_h:Sh,n="y2"===c?$h:Rh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?ai:Th,r=Ad()&&xh;return 0===l.length?"y2"===c?Gg.domain():Fg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Fg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),"y2"===c&&ei&&(f=b(ei.top)?ei.top:e,g=b(ei.bottom)?ei.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Lh?Wi?Ae(Lh):Lh:Nf.min(a,function(a){return Nf.min(a.values,function(a){return a.x})})}function bc(a){return Kh?Wi?Ae(Kh):Kh:Nf.max(a,function(a){return Nf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Xi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Mh&&Fe(Mh)?(e=b(Mh.left)?Mh.left:d,f=b(Mh.right)?Mh.right:d):e=f="number"==typeof Mh?Mh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Xi||(c=Wi?new Date(.5*c.getTime()):-.5,d=Wi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Wi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Wi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Fg:Gg;return b="y"===a.axis||"y2"===a.axis?xh?jg:"start"in a?d(a.start):jg:xh?"end"in a?Eg(Wi?Ae(a.end):a.end):jg:jg,c>b?0:b-c}function mc(a){return Og&&a===Og||Fe(Pg)&&Ge(Pg,a)}function nc(a){return!mc(a)}function oc(a){return Og?Og:Fe(Pg)?Pg[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Of.data.xs[b])}),c}function qc(a,b){return a in Of.data.xs&&Of.data.xs[a]&&Of.data.xs[a][b]?Of.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Pg[b]=a[b]})}function sc(a){return 1===Nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Sg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Of.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Wi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Yi&&!Xi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Of.data.xs[c]=a.map(function(a){return a[f]}).filter(b).map(function(a,b){return wc(a,c,b)}):Og?(d=Object.keys(Of.data.xs),Of.data.xs[c]=d.length>0?Of.data.xs[d[0]]:void 0):Fe(Pg)&&(Of.data.xs[c]=pc(f,Of.data.targets)):Of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Rg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Yi&&Xi&&0===c&&g&&(0===e&&(Bh=[]),Bh.push(g)),("undefined"==typeof a[b]||Of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Wg&&fe(Gc(c).filter(function(a){return!(a in Xg)}),Wg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Bc(a){return a>0&&Of.data.targets[0].values[a-1]?Of.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Of.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Wi?new Date(i):i);j.push(e)}return Wi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){gj=gj.concat(a)}function Pc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){hj=hj.concat(a)}function Rc(a){hj=hj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Sd(){return Zg&&"desc"===Zg.toLowerCase()}function Td(){return Zg&&"asc"===Zg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Zg&&a.sort(Zg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Of.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ji&&(Gj.html(Mi(a,db(),Cd(k),dj)).style("display","block"),d=Gj.property("offsetWidth"),e=Gj.property("offsetHeight"),k?(g=hg/2+c[0],i=jg/2+c[1]+20):(xh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Eg(l[0].x)+20):(f=s(),g=f+x()+Eg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),Gj.style("top",i+"px").style("left",g+"px"))}function Wd(){Gj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ji&&!ie(Of.data.targets)&&!le(Of.data.targets)){var d=Dj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(xh?"y1":"x1",Id).attr(xh?"y2":"x2",Id),qf(d,"grid")}}function Yd(){Dj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Dj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Eg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Of.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof ti?ti:b?2*a.tickOffset()*ui/b:0}function fe(a,b){Hc(a).forEach(function(a){Kj[a]=b===Xg[a],Xg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Xg[a.id]===b&&(c=!0),a.id in Xg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return"pie"===Wg||ge(a,"pie")}function ke(a){return"donut"===Wg||ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Xg)||"line"===Xg[b]||"spline"===Xg[b]||"area"===Xg[b]||"area-spline"===Xg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Xg[b]||"area-spline"===Xg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Xg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Xg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Xg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Xg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Di||qe(a)&&xi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Qg?Nf.time.format(Qg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Qg)}return c}function Be(a,b){var c=Nf.mouse(a),d=Nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Fg:Gg,d=xh?1:0,e=xh?0:1;return Math.pow(Eg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){kh(b,a.node()),Dj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",xh?_d:$d).attr("cy",xh?$d:_d).attr("stroke",function(){return dj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){lh(b,a.node()),Dj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return Nf.rgb(dj(b)).brighter(.75)})}function Pe(a,b){lh(b,a.node()),a.transition().duration(100).style("fill",function(){return dj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Nf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return mi?"function"==typeof ni?ni(a):ni:0}function Ve(a){return pi?qi?qi:1.75*Ue(a):Ue(a)}function We(a){return ri?ri:4*Ue(a)}function Xe(a,c){return(c?Dj.selectAll("."+g.circles+rd(c)):Dj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Nf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Dj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b,c){var d=function(a){return c(a.id)(a.value)},e=Nf.svg.line().x(xh?d:b).y(xh?b:d);return si||(e=e.defined(function(a){return null!=a.value})),function(b){var d=si?Te(b.values):b.values,f=c(b.id),g=0,h=0;return me(b)?$g[b.id]?hf(d,a,f,$g[b.id]):(e.interpolate(ne(b)?"cardinal":"linear"),e(d)):(d[0]&&(g=a(d[0].x),h=f(d[0].value)),xh?"M "+h+" "+g:"M "+g+" "+h)}}function cf(a,b){var c=gf(a,b);return function(a,b){var d=c(a,b),e=xh?1:0,f=xh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function df(a,b){var c=gf(a,!1),d=b?ef:ff;return function(a,b){return d(c(a,b),a,this)}}function ef(a,b){var c;return xh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ff(a,b,c){var d=c.getBoundingClientRect();return xh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function gf(a,b){var c=a.__max__+1,d=ee(Kg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$; +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Dj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Dj.select("."+g.axisY2),a&&(e=e.transition())),Dj.attr("transform",nj.main),c.attr("transform",nj.x),d.attr("transform",nj.y),e.attr("transform",nj.y2),Dj.select("."+g.chartArcs).attr("transform",nj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Ej.select("."+g.axisX),a&&(c=c.transition())),Ej.attr("transform",nj.context),c.attr("transform",nj.subx)}function n(a){(a?Fj.transition():Fj).attr("transform",nj.legend)}function o(a,b){l(a,b),oh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=oj?0:a,d=le(Of.data.targets),e=xh||d?0:A("x"),f=oh&&!d?ph+e:0;lg=t(),mg=u(),xh?(eg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},fg={top:eg.top,right:0/0,bottom:20+c,left:tj}):(eg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},fg={top:mg-f-c,right:0/0,bottom:e+c,left:eg.left}),gg={top:oj?0:mg-a,right:0/0,bottom:0,left:oj?lg-b:0},hg=lg-eg.left-eg.right,jg=mg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),ig=xh?eg.left-tj-uj:hg,kg=xh?jg:mg-fg.top-fg.bottom,0>ig&&(ig=0),0>kg&&(kg=0),qg=hg-(oj?b+10:0),rg=jg-(oj?0:10),r(),oj&&d&&(gg.left=qg/2+1.1*og)}function q(){Dj.select("line."+g.xgridFocus).attr("x1",xh?0:-10).attr("x2",xh?hg:-10).attr("y1",xh?-10:eg.top).attr("y2",xh?-10:jg)}function r(){og=Math.min(qg,rg)/2,ng=.95*og,pg=ke(Of.data.targets)?.6*ng:0}function s(){var a=xh?g.axisX:g.axisY,b=Dj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hj.node().getBoundingClientRect(),e=le(Of.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Rf?Rf:B()}function u(){var a=Sf?Sf:C();return a>0?a:320}function v(){return Vf?Vf:0}function w(){return Wf?Wf:0}function x(){return Tf?Tf:xh?yh?Math.max(Ke(z("x")),40):1:!Qh||Vh?1:Ke(z("y"))}function y(){var a=10,b=oj?T()+20:0;return Uf?Uf:xh?a+b:(!Zh||ci?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||yh?"x"===a&&Nh?Nh:"y"!==a||Qh?"y2"!==a||Zh?(ob(a).isInner?30:40)+("y2"===a?-10:0):vj:rh&&!oj?10:1:0}function B(){return+Hj.style("width").replace("px","")}function C(){return+Hj.style("height").replace("px","")}function D(a){return a?-31:-(eg.left-1)}function E(a){return a?-20:-4}function F(){return D(!xh)}function G(){return E(!xh)}function H(){return D(xh)}function I(){return E(xh)}function J(a){return a?hg+2+30+30:eg.left+20}function K(a){return a?(Nh?Nh:0)+80:jg+8}function L(){return J(!xh)}function M(){return K(!xh)}function N(){return J(xh)}function O(){return K(xh)}function P(){var a,b,c,d,e,f=Ec(Of.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Eg(b.x)-Eg(a.x),0===c?xh?jg:hg:(d=Dc(),e=he(Of.data.targets)?(d-(Xi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){pj=a}function R(a){qj=a}function S(a){rj=a}function T(){return rh?oj?qj*(pj+1):lg:0}function U(){return rh?oj?mg:rj*(pj+1):0}function V(){var a,b,c=!Eg;wg=xh?1:0,xg=xh?jg:hg,yg=xh?0:jg,zg=xh?hg:1,Ag=wg,Bg=xg,Cg=xh?0:kg,Dg=xh?ig:1,Eg=Y(wg,xg,c?void 0:Eg.domain(),function(){return Kg.tickOffset()}),Fg=Z(yg,zg,c?void 0:Fg.domain()),Gg=Z(yg,zg,c?void 0:Gg.domain()),Hg=Y(wg,xg,Ij,function(a){return a%1?0:Ng.tickOffset()}),Ig=Z(Cg,Dg,c?void 0:Ig.domain()),Jg=Z(Cg,Dg,c?void 0:Jg.domain()),a=db(),b=Ih?Ih:c?void 0:Kg.tickValues(),Kg=ab(Eg,jj,a,b),Ng=ab(Hg,mj,a,b),Lg=bb(Fg,kj,Wh,Yh),Mg=bb(Gg,lj,di,fi),c||(wj.scale(Hg),Xf&&Aj.scale(Eg)),W()}function W(){sg=Kb(),tg=Lb(),ug=Lb(.98)}function X(a,b,c){return(c?Nf.time.scale():Nf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Wi),g=c?f.domain(c):f;Xi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Ij&&Ij[0]===a[0]&&Ij[1]a?a.toFixed(0):a};return Dh&&("function"==typeof Dh?a=Dh:Wi&&(a=function(a){return a?ej(Dh)(a):""})),a}function eb(a){var b;return"y"===a?b=Uh:"y2"===a?b=bi:"x"===a&&(b=Ph),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Uh=b:"y2"===a?bi=b:"x"===a&&(Ph=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function lb(){return kb("x",xh?"inner-top":"inner-right")}function mb(){return kb("y",xh?"inner-right":"inner-top")}function nb(){return kb("y2",xh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?hg/2:hg:b.isBottom?-jg:b.isMiddle?-jg/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!xh,lb())}function wb(){return sb(xh,mb())}function xb(){return sb(xh,nb())}function yb(){return tb(!xh,lb())}function zb(){return tb(xh,mb())}function Ab(){return tb(xh,nb())}function Bb(){var a=lb();return xh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Nh?Nh-10:"3em"}function Cb(){var a=mb();return xh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return xh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!xh,lb())}function Fb(){return ub(xh,mb())}function Gb(){return ub(xh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Dj.select("."+g.axisX+" ."+g.axisXLabel),c=Dj.select("."+g.axisY+" ."+g.axisYLabel),d=Dj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return vg(Lc(Of.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),b?a:null}function Kb(){var a=Nf.svg.arc().outerRadius(ng).innerRadius(pg),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Nf.svg.arc().outerRadius(og*(a?a:1)).innerRadius(pg);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?sg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=sg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ng*.8+","+d/e*ng*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Bj.selectAll("."+g.chartArc+sd(a)),d=Bj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",tg).transition().duration(100).attr("d",ug).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Bj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",sg),Bj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Of.data.targets)?Bi:vi}function Ub(){return ke(Of.data.targets)?Ci:wi}function Vb(){return ke(Of.data.targets)?Ei:""}function Wb(){var a=ke(Of.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Of.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Of.data.targets)?Hi:Ai;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Ug.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Nf.min(Object.keys(i).map(function(a){return Nf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Ug.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Nf.max(Object.keys(i).map(function(a){return Nf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?_h:Sh,n="y2"===c?$h:Rh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?ai:Th,r=Ad()&&xh;return 0===l.length?"y2"===c?Gg.domain():Fg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Fg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),"y2"===c&&ei&&(f=b(ei.top)?ei.top:e,g=b(ei.bottom)?ei.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Lh?Wi?Ae(Lh):Lh:Nf.min(a,function(a){return Nf.min(a.values,function(a){return a.x})})}function bc(a){return Kh?Wi?Ae(Kh):Kh:Nf.max(a,function(a){return Nf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Xi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Mh&&Fe(Mh)?(e=b(Mh.left)?Mh.left:d,f=b(Mh.right)?Mh.right:d):e=f="number"==typeof Mh?Mh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Xi||(c=Wi?new Date(.5*c.getTime()):-.5,d=Wi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Wi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Wi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Fg:Gg;return b="y"===a.axis||"y2"===a.axis?xh?jg:"start"in a?d(a.start):jg:xh?"end"in a?Eg(Wi?Ae(a.end):a.end):jg:jg,c>b?0:b-c}function mc(a){return Og&&a===Og||Fe(Pg)&&Ge(Pg,a)}function nc(a){return!mc(a)}function oc(a){return Og?Og:Fe(Pg)?Pg[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Of.data.xs[b])}),c}function qc(a,b){return a in Of.data.xs&&Of.data.xs[a]&&Of.data.xs[a][b]?Of.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Pg[b]=a[b]})}function sc(a){return 1===Nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Sg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Of.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Wi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Yi&&!Xi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Of.data.xs[c]=a.map(function(a){return a[f]}).filter(b).map(function(a,b){return wc(a,c,b)}):Og?(d=Object.keys(Of.data.xs),Of.data.xs[c]=d.length>0?Of.data.xs[d[0]]:void 0):Fe(Pg)&&(Of.data.xs[c]=pc(f,Of.data.targets)):Of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Rg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Yi&&Xi&&0===c&&g&&(0===e&&(Bh=[]),Bh.push(g)),("undefined"==typeof a[b]||Of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Wg&&fe(Gc(c).filter(function(a){return!(a in Xg)}),Wg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Bc(a){return a>0&&Of.data.targets[0].values[a-1]?Of.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Of.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Wi?new Date(i):i);j.push(e)}return Wi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){gj=gj.concat(a)}function Pc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){hj=hj.concat(a)}function Rc(a){hj=hj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Sd(){return Zg&&"desc"===Zg.toLowerCase()}function Td(){return Zg&&"asc"===Zg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Zg&&a.sort(Zg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Of.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ji&&(Gj.html(Mi(a,db(),Cd(k),dj)).style("display","block"),d=Gj.property("offsetWidth"),e=Gj.property("offsetHeight"),k?(g=hg/2+c[0],i=jg/2+c[1]+20):(xh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Eg(l[0].x)+20):(f=s(),g=f+x()+Eg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),Gj.style("top",i+"px").style("left",g+"px"))}function Wd(){Gj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ji&&!ie(Of.data.targets)&&!le(Of.data.targets)){var d=Dj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(xh?"y1":"x1",Id).attr(xh?"y2":"x2",Id),qf(d,"grid")}}function Yd(){Dj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Dj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Eg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Of.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof ti?ti:b?2*a.tickOffset()*ui/b:0}function fe(a,b){Hc(a).forEach(function(a){Kj[a]=b===Xg[a],Xg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Xg[a.id]===b&&(c=!0),a.id in Xg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return"pie"===Wg||ge(a,"pie")}function ke(a){return"donut"===Wg||ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Xg)||"line"===Xg[b]||"spline"===Xg[b]||"area"===Xg[b]||"area-spline"===Xg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Xg[b]||"area-spline"===Xg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Xg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Xg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Xg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Xg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Di||qe(a)&&xi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Qg?Nf.time.format(Qg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Qg)}return c}function Be(a,b){var c=Nf.mouse(a),d=Nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Fg:Gg,d=xh?1:0,e=xh?0:1;return Math.pow(Eg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){kh(b,a.node()),Dj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",xh?_d:$d).attr("cy",xh?$d:_d).attr("stroke",function(){return dj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){lh(b,a.node()),Dj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return Nf.rgb(dj(b)).brighter(.75)})}function Pe(a,b){lh(b,a.node()),a.transition().duration(100).style("fill",function(){return dj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Nf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return mi?"function"==typeof ni?ni(a):ni:0}function Ve(a){return pi?qi?qi:1.75*Ue(a):Ue(a)}function We(a){return ri?ri:4*Ue(a)}function Xe(a,c){return(c?Dj.selectAll("."+g.circles+rd(c)):Dj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Nf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Dj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b,c){var d=function(a){return c(a.id)(a.value)},e=Nf.svg.line().x(xh?d:b).y(xh?b:d);return si||(e=e.defined(function(a){return null!=a.value})),function(b){var d=si?Te(b.values):b.values,f=c(b.id),g=0,h=0;return me(b)?$g[b.id]?hf(d,a,f,$g[b.id]):(e.interpolate(ne(b)?"cardinal":"linear"),e(d)):(d[0]&&(g=a(d[0].x),h=f(d[0].value)),xh?"M "+h+" "+g:"M "+g+" "+h)}}function cf(a,b){var c=gf(a,b);return function(a,b){var d=c(a,b),e=xh?1:0,f=xh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function df(a,b){var c=gf(a,!1),d=b?ef:ff;return function(a,b){return d(c(a,b),a,this)}}function ef(a,b){var c;return xh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ff(a,b,c){var d=c.getBoundingClientRect();return xh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function gf(a,b){var c=a.__max__+1,d=ee(Kg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$; return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return xh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function hf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function jf(b){var c,d,e;if(Hj=Nf.select(Qf),Hj.empty())throw new Error("Element to bind not found");if(Hj.html("").classed("c3",!0),Of.data.xs={},Of.data.targets=zc(b),ch&&(Of.data.targets=Of.data.targets.filter(ch)),bh&&Oc(bh===!0?Gc(Of.data.targets):bh),p(),V(),Eg.domain(Nf.extent(dc(Of.data.targets))),Fg.domain(_b(Of.data.targets,"y")),Gg.domain(_b(Of.data.targets,"y2")),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Jg.domain(Gg.domain()),Ij=Eg.domain(),wj.scale(Hg),Xf&&Aj.scale(Eg),Bj=Hj.append("svg").style("overflow","hidden").on("mouseenter",_f).on("mouseleave",ag),Cj=Bj.append("defs"),Cj.append("clipPath").attr("id",Qi).append("rect"),Cj.append("clipPath").attr("id",Ri).append("rect"),Cj.append("clipPath").attr("id",Si).append("rect"),vf(),Dj=Bj.append("g").attr("transform",nj.main),Ej=Bj.append("g").attr("transform",nj.context),Fj=Bj.append("g").attr("transform",nj.legend),oh||Ej.style("visibility","hidden"),rh||(Fj.style("visibility","hidden"),hj=Gc(Of.data.targets)),Gj=Hj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),If(Gc(Of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Dj.append("g").attr("clip-path",Ti).attr("class",g.grid),gi&&d.append("g").attr("class",g.xgrids),Fe(ii)&&d.append("g").attr("class",g.xgridLines),oi&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ji&&d.append("g").attr("class",g.ygrids),Fe(ki)&&d.append("g").attr("class",g.ygridLines),Dj.append("g").attr("clip-path",Ti).attr("class",g.regions),Dj.append("g").attr("clip-path",Ti).attr("class",g.chart),c=Dj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Xf?xh?"ns-resize":"ew-resize":null),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",nj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Dj.select("."+g.chart).append("g").attr("class",g.chartTexts),Xf&&Dj.insert("rect",Zf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",hg).attr("height",jg).style("opacity",0).style("cursor",xh?"ns-resize":"ew-resize").call(Aj).on("dblclick.zoom",null),Oh&&wj.extent("function"!=typeof Oh?Oh:Oh(dc())),ij.x=Dj.append("g").attr("class",g.axisX).attr("clip-path",Ui).attr("transform",nj.x).style("visibility",yh?"visible":"hidden"),ij.x.append("text").attr("class",g.axisXLabel).attr("transform",xh?"rotate(-90)":"").style("text-anchor",Eb),ij.y=Dj.append("g").attr("class",g.axisY).attr("clip-path",Vi).attr("transform",nj.y).style("visibility",Qh?"visible":"hidden"),ij.y.append("text").attr("class",g.axisYLabel).attr("transform",xh?"":"rotate(-90)").style("text-anchor",Fb),ij.y2=Dj.append("g").attr("class",g.axisY2).attr("transform",nj.y2).style("visibility",Zh?"visible":"hidden"),ij.y2.append("text").attr("class",g.axisY2Label).attr("transform",xh?"":"rotate(-90)").style("text-anchor",Gb),Ej.append("g").attr("clip-path",Ti).attr("class",g.chart),Ej.select("."+g.chart).append("g").attr("class",g.chartBars),Ej.select("."+g.chart).append("g").attr("class",g.chartLines),Ej.append("g").attr("clip-path",Ti).attr("class",g.brush).call(wj).selectAll("rect").attr(xh?"width":"height",xh?ig:kg),ij.subx=Ej.append("g").attr("class",g.axisX).attr("transform",nj.subx).attr("clip-path",xh?"":Ui),yf(Of.data.targets),rf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ni){if(Wi&&"string"==typeof Oi){for(Oi=Ae(Oi),e=0;ef&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function of(a){le(Of.data.targets)||dh&&(Zi=a,Dj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),$i=!0,mh())}function pf(){le(Of.data.targets)||dh&&(Dj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Dj.selectAll("."+g.shape).classed(g.INCLUDED,!1),$i=!1,nh())}function qf(a,b){"grid"===b&&a.each(function(){var a=Nf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function rf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Of.data.targets),ab=Lc(Of.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?dg:0,U=H?T:0,W=I?T:0,c=c||wf(W),N&&(xh?(ij.x.call(Kg),ij.subx.call(Ng)):(ij.y.call(Lg),ij.y2.call(Mg)),p(),V(),vf(),o(!1)),M&&rh&&If(Gc(Of.data.targets),a,c),Xi&&0===ab.length&&Eg.domain([0,ij.x.selectAll(".tick").size()]),ab.length&&(L&&(Eg.domain(Nf.extent(dc(ab))),Ij=Eg.domain(),Xf&&Aj.scale(Eg).updateScaleExtent(),Hg.domain(Eg.domain()),wj.scale(Hg)),K&&(Eg.domain(wj.empty()?Ij:wj.extent()),Xf&&Aj.scale(Eg).updateScaleExtent()),Ih||!Hh&&!Gh||(X=Nc(Mc(ab),Gh),Kg.tickValues(X),Ng.tickValues(X))),Fg.domain(_b(ab,"y")),Gg.domain(_b(ab,"y2")),ij.x.style("opacity",_?0:1),ij.y.style("opacity",_?0:1),ij.y2.style("opacity",_?0:1),ij.subx.style("opacity",_?0:1),c.axisX.call(Kg),c.axisY.call(Lg),c.axisY2.call(Mg),c.axisSubX.call(Ng),Ib(G),K&&ab.length)if(Eh&&X){for(Y=1;Y=0&&Nf.select(this).style("display",b%Z?"none":"block")})}else Bj.selectAll("."+g.axisX+" .tick text").style("display","block");!xh&&Jh&&jb(ij.x,c.axisX,Jh),O=cf($),R=df($,!0),S=df($,!1),Ig.domain(Fg.domain()),Jg.domain(Gg.domain()),Gj.style("display","none"),q(),Dj.select("line."+g.xgridFocus).style("visibility","hidden"),gi&&(f=Zd(hi,Eg),B=Xi?Kg.tickOffset():0,e=xh?{x1:0,x2:hg,y1:function(a){return Eg(a)-B},y2:function(a){return Eg(a)-B}}:{x1:function(a){return Eg(a)+B},x2:function(a){return Eg(a)+B},y1:eg.top,y2:jg},d=Dj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Nf.select(this).attr(xh?"y1":"x1")===(xh?jg:0)?0:1}),d.exit().remove()),Fe(ii)&&(h=Dj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(ii),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",xh?"":"rotate(-90)").attr("dx",xh?0:-eg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",xh?0:Jd).attr("x2",xh?hg:Jd).attr("y1",xh?Jd:eg.top).attr("y2",xh?Jd:jg).style("opacity",1),h.select("text").transition().duration(T).attr("x",xh?hg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ji&&(j=Dj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Fg.ticks(li)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",xh?Fg:0).attr("x2",xh?Fg:hg).attr("y1",xh?0:Fg).attr("y2",xh?jg:Fg),j.exit().remove(),qf(j,"grid")),E&&Fe(ki)&&(k=Dj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ki),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",xh?"rotate(-90)":"").attr("dx",xh?0:-eg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",xh?Kd:0).attr("x2",xh?Kd:hg).attr("y1",xh?0:Kd).attr("y2",xh?jg:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",xh?0:hg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Dj.select("."+g.regions).selectAll("."+g.region).data(Ii),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",dj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",dj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",dj),m.style("opacity",wd).transition().duration(T).attr("d",xj).style("stroke",dj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Dj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",dj).style("opacity",function(){return Jj=+Nf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",zj).style("fill",dj).style("opacity",Jj),n.exit().transition().duration(U).style("opacity",0).remove(),r=Dj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",dj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",dj).attr("cx",xh?_d:$d).attr("cy",xh?$d:_d),r.exit().remove(),v=Dj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return xh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",dj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",dj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Dj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return dj(a.data)}).style("cursor",function(a){return fh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;bj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Ef(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Nf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;bj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ff(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();mf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){bj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Nf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return dj(a.data)}).style("opacity",1).call(Ie,function(){bj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Dj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Dj.select("."+g.chartArcsTitle).style("opacity",ke(Of.data.targets)?1:0),oh&&(Nf.event&&"zoom"===Nf.event.type&&wj.extent(Eg.orgDomain()).update(),F&&(!xh&&Jh&&jb(ij.subx,c.axisSubX,Jh),wj.empty()||wj.extent(Eg.orgDomain()).update(),Q=cf($,!0),x=Ej.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",dj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Ej.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",dj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Dj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Dj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",xh?_d:$d).attr("cy",xh?$d:_d),$f&&(y=Dj.select("."+g.eventRects),Fe(Pg)&&!sc(Pg)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Dj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),lf(z.enter()),z.attr("x",0).attr("y",0).attr("width",hg).attr("height",jg)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!Yi&&!Wi||Xi?(D=P(),C=function(a){return Eg(a.x)-D/2}):(D=function(a,b){var c=Bc(b),d=Cc(b),e=Of.data.xs[a.id][b];return(Eg(d?d:1.1*e)-Eg(c?c:.9*e))/2},C=function(a,b){var c=Bc(b),d=Of.data.xs[a.id][b];return(Eg(d)+Eg(c?c:.9*d))/2}),A=Ec(Of.data.targets),Dj.select("."+g.eventRects).datum(A?A.values:[]),z=Dj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),kf(z.enter()),z.attr("class",ld).attr("x",xh?0:C).attr("y",xh?C:0).attr("width",xh?hg:D).attr("height",xh?D:jg),z.exit().remove())),Gc(Of.data.targets).forEach(function(a){Kj[a]=!0})}function sf(){rf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function tf(){if(0!==Lc(Of.data.targets).length){if("mousemove"===Nf.event.sourceEvent.type&&Aj.altDomain)return Eg.domain(Aj.altDomain),void Aj.scale(Eg).updateScaleExtent();Xi&&Eg.orgDomain()[0]===Ij[0]&&Eg.domain([Ij[0]-1e-10,Eg.orgDomain()[1]]),rf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Nf.event.sourceEvent.type&&(_i=!0)}}function uf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function vf(){Bj.attr("width",lg).attr("height",mg),Bj.select("#"+Qi).select("rect").attr("width",hg).attr("height",jg),Bj.select("#"+Ri).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Bj.select("#"+Si).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Bj.select("."+g.zoomRect).attr("width",hg).attr("height",jg),Hj.style("max-height",mg+"px")}function wf(a){return{axisX:a?ij.x.transition().duration(a):ij.x,axisY:a?ij.y.transition().duration(a):ij.y,axisY2:a?ij.y2.transition().duration(a):ij.y2,axisSubX:a?ij.subx.transition().duration(a):ij.subx}}function xf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&rh||(b=wf(a.withTransitionForAxis?dg:0),p(),V(),vf(),o(a.withTransition,b)),rf(a,b)}function yf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Dj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return fh(a)?"pointer":null}),c=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return fh(a)?"pointer":null}),a.forEach(function(a){Dj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Dj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(vg(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),oh&&(n=Ej.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Ej.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Bj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(dg).style("opacity",1)}function zf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=oj?j:i,l=oj?U():T();return d&&(z=0,F=0,w=0,x=0),rh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=oj?x:w,void(wh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Fj.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),oj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Fj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof th?th(a):Of.toggle(a)}).on("mouseover",function(a){Nf.select(this).classed(g.legendItemFocused,!0),bj||Of.focus(a),"function"==typeof uh&&uh(a)}).on("mouseout",function(a){Nf.select(this).classed(g.legendItemFocused,!1),bj||Of.revert(),"function"==typeof vh&&vh(a)}),m.append("text").text(function(a){return d(Sg[a])?Sg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",oj?h:-200).attr("y",oj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",oj?i:-200).attr("y",oj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",dj).attr("x",oj?h:-200).attr("y",oj?-200:j).attr("width",10).attr("height",10),r=Fj.selectAll("text").data(a).text(function(a){return d(Sg[a])?Sg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Fj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Fj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",dj).attr("x",f).attr("y",j),Fj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Nf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Cf(b):Df(b):sj}),R(w),S(x),Q(F),p(),V(),vf(),o(q,c)}function Jf(a){return Ic(Of.data.targets,a.id)}function Kf(a){return"data"in a&&Ic(Of.data.targets,a.data.id)}function Lf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Mf(a,b,c){var d=!le(Of.data.targets);bj=!1,fe(a,b),xf(c||{withTransitionForAxis:d})}var Nf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Of={data:{},axis:{},legend:{}},Pf={},Qf=i(["bindto"],"#chart"),Rf=i(["size","width"]),Sf=i(["size","height"]),Tf=i(["padding","left"]),Uf=i(["padding","right"]),Vf=i(["padding","top"]),Wf=i(["padding","bottom"]),Xf=i(["zoom","enabled"],!1),Yf=i(["zoom","extent"]),Zf=i(["zoom","privileged"],!1),$f=i(["interaction","enabled"],!0),_f=i(["onenter"],function(){}),ag=i(["onleave"],function(){}),bg=i(["onresize"],function(){}),cg=i(["onresized"],function(){}),dg=i(["transition","duration"],350);h("data","data is required in config");var eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og=i(["data","x"]),Pg=i(["data","xs"],{}),Qg=i(["data","x_format"]),Rg=i(["data","id_converter"],function(a){return a}),Sg=i(["data","names"],{}),Tg=i(["data","classes"],{}),Ug=i(["data","groups"],[]),Vg=i(["data","axes"],{}),Wg=i(["data","type"]),Xg=i(["data","types"],{}),Yg=i(["data","labels"],{}),Zg=i(["data","order"]),$g=i(["data","regions"],{}),_g=i(["data","color"]),ah=i(["data","colors"],{}),bh=i(["data","hide"],!1),ch=i(["data","filter"]),dh=i(["data","selection","enabled"],!1),eh=i(["data","selection","grouped"],!1),fh=i(["data","selection","isselectable"],function(){return!0}),gh=i(["data","selection","multiple"],!0),hh=i(["data","onclick"],function(){}),ih=i(["data","onenter"],function(){}),jh=i(["data","onleave"],function(){}),kh=i(["data","onselected"],function(){}),lh=i(["data","onunselected"],function(){}),mh=i(["data","ondragstart"],function(){}),nh=i(["data","ondragend"],function(){}),oh=i(["subchart","show"],!1),ph=i(["subchart","size","height"],60),qh=i(["color","pattern"],[]),rh=i(["legend","show"],!0),sh=i(["legend","position"],"bottom"),th=i(["legend","item","onclick"]),uh=i(["legend","item","onmouseover"]),vh=i(["legend","item","onmouseout"]),wh=i(["legend","equally"],!1),xh=i(["axis","rotated"],!1),yh=i(["axis","x","show"],!0),zh=i(["axis","x","type"],"indexed"),Ah=i(["axis","x","localtime"],!0),Bh=i(["axis","x","categories"],[]),Ch=i(["axis","x","tick","centered"],!1),Dh=i(["axis","x","tick","format"]),Eh=i(["axis","x","tick","culling"],{}),Fh=i(["axis","x","tick","culling","max"],10),Gh=i(["axis","x","tick","count"]),Hh=i(["axis","x","tick","fit"],!0),Ih=i(["axis","x","tick","values"],null),Jh=i(["axis","x","tick","rotate"]),Kh=i(["axis","x","max"],null),Lh=i(["axis","x","min"],null),Mh=i(["axis","x","padding"],{}),Nh=i(["axis","x","height"]),Oh=i(["axis","x","default"]),Ph=i(["axis","x","label"],{}),Qh=i(["axis","y","show"],!0),Rh=i(["axis","y","max"]),Sh=i(["axis","y","min"]),Th=i(["axis","y","center"]),Uh=i(["axis","y","label"],{}),Vh=i(["axis","y","inner"],!1),Wh=i(["axis","y","tick","format"]),Xh=i(["axis","y","padding"]),Yh=i(["axis","y","ticks"],10),Zh=i(["axis","y2","show"],!1),$h=i(["axis","y2","max"]),_h=i(["axis","y2","min"]),ai=i(["axis","y2","center"]),bi=i(["axis","y2","label"],{}),ci=i(["axis","y2","inner"],!1),di=i(["axis","y2","tick","format"]),ei=i(["axis","y2","padding"]),fi=i(["axis","y2","ticks"],10),gi=i(["grid","x","show"],!1),hi=i(["grid","x","type"],"tick"),ii=i(["grid","x","lines"],[]),ji=i(["grid","y","show"],!1),ki=i(["grid","y","lines"],[]),li=i(["grid","y","ticks"],10),mi=i(["point","show"],!0),ni=i(["point","r"],2.5),oi=i(["point","focus","line","enabled"],!0),pi=i(["point","focus","expand","enabled"],!0),qi=i(["point","focus","expand","r"]),ri=i(["point","focus","select","r"]),si=i(["line","connect_null"],!1),ti=i(["bar","width"]),ui=i(["bar","width","ratio"],.6),vi=i(["pie","label","show"],!0),wi=i(["pie","label","format"]),xi=i(["pie","expand"],!0),yi=i(["pie","onclick"],function(){}),zi=i(["pie","onmouseover"],function(){}),Ai=i(["pie","onmouseout"],function(){}),Bi=i(["donut","label","show"],!0),Ci=i(["donut","label","format"]),Di=i(["donut","expand"],!0),Ei=i(["donut","title"],""),Fi=i(["donut","onclick"],function(){}),Gi=i(["donut","onmouseover"],function(){}),Hi=i(["donut","onmouseout"],function(){}),Ii=i(["regions"],[]),Ji=i(["tooltip","show"],!0),Ki=i(["tooltip","format","title"]),Li=i(["tooltip","format","value"]),Mi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ki?Ki:b,l=Li?Li:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ni=i(["tooltip","init","show"],!1),Oi=i(["tooltip","init","x"],0),Pi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Qi=("string"==typeof Qf?Qf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Ri=Qi+"-xaxis",Si=Qi+"-yaxis",Ti=j(Qi),Ui=j(Ri),Vi=j(Si),Wi="timeseries"===zh,Xi="categorized"===zh,Yi=!Wi&&(Og||Fe(Pg)),Zi=null,$i=!1,_i=!1,aj=!1,bj=!1,cj=Nf.scale.category10().range(),dj=ze(ah,Fe(qh)?qh:cj,_g),ej=Ah?Nf.time.format:Nf.time.format.utc,fj=ej.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0 }]]),gj=[],hj=[],ij={},jj=xh?"left":"bottom",kj=xh?Vh?"top":"bottom":Vh?"right":"left",lj=xh?ci?"bottom":"top":ci?"left":"right",mj=xh?"left":"bottom",nj={main:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},context:function(){return"translate("+k(fg.left)+","+k(fg.top)+")"},legend:function(){return"translate("+gg.left+","+gg.top+")"},x:function(){return"translate(0,"+(xh?0:jg)+")"},y:function(){return"translate(0,"+(xh?jg:0)+")"},y2:function(){return"translate("+(xh?0:hg)+","+(xh?1:0)+")"},subx:function(){return"translate(0,"+(xh?0:kg)+")"},arc:function(){return"translate("+qg/2+","+rg/2+")"}},oj="right"===sh,pj=0,qj=0,rj=0,sj=.15,tj=30,uj=xh&&!yh?0:30,vj=5;vg=Nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var wj,xj=bf(Eg,Id,$),yj=bf(Hg,Ld,_),zj=function(){var a;return a=xh?Nf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Nf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Eg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,xh?"M "+d+" "+c:"M "+c+" "+d)}}(),Aj=function(){};wj=Nf.svg.brush().on("brush",sf),wj.update=function(){return Ej&&Ej.select("."+g.brush).call(this),this},wj.scale=function(a){return xh?this.y(a):this.x(a)},Xf&&(Aj=Nf.behavior.zoom().on("zoomstart",function(){Aj.altDomain=Nf.event.sourceEvent.altKey?Eg.orgDomain():null}).on("zoom",Xf?tf:null),Aj.scale=function(a){return xh?this.y(a):this.x(a)},Aj.orgScaleExtent=function(){var a=Yf?Yf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},Aj.updateScaleExtent=function(){var a=ec(Eg.orgDomain())/ec(Ij),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj,Kj={};if(Of.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Bj.selectAll(sd(a)),d=c.filter(Jf),e=c.filter(Kf);Of.revert(),Of.defocus(),b(d.classed(g.focused,!0)),b(e),le(Of.data.targets)&&Rb(a,!0),Ef(a,!0)},Of.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Bj.selectAll(sd(a)),d=c.filter(Jf),e=c.filter(Kf);Of.revert(),b(d.classed(g.focused,!1)),b(e),le(Of.data.targets)&&Sb(a),Ef(a,!1)},Of.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Bj.selectAll(sd(a)),d=c.filter(Jf),e=c.filter(Kf);b(d.classed(g.focused,!1)),b(e),le(Of.data.targets)&&Sb(a),Ff()},Of.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Bj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Gf(a),rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Of.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Bj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Hf(a),rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Of.toggle=function(a){Jc(a)?Of.hide(a):Of.show(a)},Of.unzoom=function(){wj.clear().update(),rf({withUpdateXDomain:!0})},Of.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Tg[b]=a.classes[b]}),"categories"in a&&Xi&&(Bh=a.categories,Kg.categories(Bh)),"cacheIds"in a&&fc(a.cacheIds)?void zf(hc(a.cacheIds),a.done):void("unload"in a?Bf(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Af(a)}):Af(a))},Of.unload=function(a,b){Bf(Hc(a),function(){rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Of.selected=function(a){return Nf.merge(Dj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Nf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Of.select=function(a,b,c){dh&&Dj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Nf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=eh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?fh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Of.unselect=function(a,b){dh&&Dj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Nf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=eh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&fh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Of.toLine=function(a){Mf(a,"line")},Of.toSpline=function(a){Mf(a,"spline")},Of.toBar=function(a){Mf(a,"bar")},Of.toScatter=function(a){Mf(a,"scatter")},Of.toArea=function(a){Mf(a,"area")},Of.toAreaSpline=function(a){Mf(a,"area-spline")},Of.toPie=function(a){Mf(a,"pie",{withTransform:!0})},Of.toDonut=function(a){Mf(a,"donut",{withTransform:!0})},Of.groups=function(a){return c(a)?Ug:(Ug=a,rf(),Ug)},Of.xgrids=function(a){return a?(ii=a,rf(),ii):ii},Of.xgrids.add=function(a){return a?Of.xgrids(ii.concat(a)):void 0},Of.xgrids.remove=function(a){var b=Lf(a);return Of.xgrids(ii.filter(b))},Of.ygrids=function(a){return a?(ki=a,rf(),ki):ki},Of.ygrids.add=function(a){return a?Of.ygrids(ki.concat(a)):void 0},Of.ygrids.remove=function(a){var b=Lf(a);return Of.ygrids(ki.filter(b))},Of.regions=function(a){return a?(Ii=a,rf(),Ii):Ii},Of.regions.add=function(a){return a?(Ii=Ii.concat(a),rf(),Ii):Ii},Of.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",dg),c=Je(a,"classes",[g.region]),d=Dj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Ii=Ii.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},Of.data.get=function(a){var b=Of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Of.data.getAsTarget=function(a){var b=Of.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),rf({withLegend:!0}),Sg):Sg},Of.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ah[b]=a[b]}),rf({withLegend:!0}),ah):ah},Of.x=function(a){return arguments.length&&(uc(Of.data.targets,a),rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Of.data.xs},Of.xs=function(a){return arguments.length&&(vc(Of.data.targets,a),rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Of.data.xs},Of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Lh=+a.x),b(a.y)&&(Sh=+a.y),b(a.y2)&&(_h=+a.y2)):Sh=_h=+a,rf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Of.axis.max(a.max),"undefined"!=typeof a.min&&Of.axis.min(a.min))},Of.legend.show=function(a){Gf(Hc(a)),rf({withLegend:!0})},Of.legend.hide=function(a){Hf(Hc(a)),rf({withLegend:!0})},Of.resize=function(a){Rf=a?a.width:null,Sf=a?a.height:null,xf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Of.destroy=function(){Of.data.targets=void 0,Of.data.xs={},Hj.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)Nf.xhr(f.data.url,function(a,b){var c,d=Nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Nf.csv.parse(b.response),jf(c)});else if("rows"in f.data)jf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");jf(yc(f.data.columns))}return Of},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file