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