|
|
|
!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}var e={};e.generate=function(e){function f(a,b){if(!(a in e))throw Error(b)}function g(a,b){var c,d,f,g=e;for(c=0;c<a.length;c++){if("object"==typeof g&&!(a[c]in g))return b;if(d=c===a.length-1,f=g[a[c]],!d&&"object"!=typeof f||d&&"object"!=typeof b&&"object"==typeof f)return b;g=f}return g}function h(a){return"url("+document.URL.split("#")[0]+"#"+a+")"}function i(){$h.attr("transform",Lh.main),$h.select("."+Pe.axisX).attr("transform",Lh.x),$h.select("."+Pe.axisY).attr("transform",Lh.y),$h.select("."+Pe.axisY2).attr("transform",Lh.y2),$h.select("."+Pe.chartArcs).attr("transform",Lh.arc)}function j(){gg&&(_h.attr("transform",Lh.context),_h.select("."+Pe.axisX).attr("transform",Lh.subx))}function k(a){var b=a!==!1?250:0;jg&&ai.transition().duration(b).attr("transform",Lh.legend)}function l(a){i(a),j(a),k(a)}function m(){gf=p(),hf=q(),jf=O(),kf=N(),_e={top:ng?u("y2"):Sh,right:s(),bottom:u(ng?"y":"x")+(ng?0:hg)+(Mh?0:jf),left:(ng?hg+Rh:0)+r()},cf=gf-_e.left-_e.right,ef=hf-_e.top-_e.bottom,0>cf&&(cf=0),0>ef&&(ef=0),af={top:ng?_e.top:hf-hg-(Mh?0:jf),right:0/0,bottom:20+(Mh?0:jf),left:ng?Qh:_e.left},df=ng?_e.left-Qh-Rh:cf,ff=ng?ef:hf-af.top-af.bottom,0>df&&(df=0),0>ff&&(ff=0),bf={top:Mh?0:hf-jf,right:0/0,bottom:0,left:Mh?gf-kf:0},n(),Mh&&Cd(Ke.data.targets)&&(bf.left=cf/2+mf)}function n(){mf=ef/2,lf=.95*mf,nf=Bd(Ke.data.targets)?.6*lf:0}function o(){var a=ng?Pe.axisX:Pe.axisY,b=Je.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Je.select(Qe).node().getBoundingClientRect(),e=c.right-d.left-r();return e>0?e:0}function p(){return Re?Re:v()}function q(){var a=Se?Se:w();return a>0?a:320}function r(){return Cd(Ke.data.targets)?0:Te?Te:ng||!yg||Dg?1:t("y")}function s(){var a=1;return Cd(Ke.data.targets)?0:Ue?Ue:Mh?kf+(Hg&&!ng?t("y2"):a):Hg?Mg||ng?a:t("y2"):a}function t(a){var b=db(a);return b.isInner?20+wb(a):40+wb(a)}function u(a){return"y"!==a||yg?"y2"!==a||Hg?(db(a).isInner?30:40)+("y2"===a?-10:0):Sh:jg&&!Mh?10:1}function v(){return+Je.select(Qe).style("width").replace("px","")}function w(){return+Je.select(Qe).style("height").replace("px","")}function x(a){return a?-5:-(_e.left-1)}function y(a){return a?-20:-1}function z(){return x(!ng)}function A(){return y(!ng)}function B(){return x(ng)}function C(){return y(ng)}function D(a){return a?cf+2+4:_e.left+20}function E(a){return a?80:ef+2}function F(){return D(!ng)}function G(){return E(!ng)}function H(){return D(ng)}function I(){return E(ng)}function J(){var a=ng?ef:cf,b=pc(),c=Rb()*(yd(Ke.data.targets)?(b-(yh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function K(a){Nh=a}function L(a){Oh=a}function M(a){Ph=a}function N(){return jg?Mh?Oh*(Nh+1):gf:0}function O(){return jg?Mh?hf:Ph*(Nh+1):0}function P(){var a,b,c=!Af;sf=ng?1:0,tf=ng?ef:cf,uf=ng?0:ef,vf=ng?cf:1,wf=sf,xf=tf,yf=ng?0:ff,zf=ng?df:1,Af=R(sf,tf,c?void 0:Af.domain(),function(){return Gf.tickOffset()}),Bf=S(uf,vf),Cf=S(uf,vf),Df=R(sf,tf,di,function(a){return a%1?0:Jf.tickOffset()}),Ef=S(yf,zf),Ff=S(yf,zf),a=Y(),b=Z(),Gf=V(Af,Hh,a,b),Jf=V(Df,Kh,a,b),Hf=W(Bf,Ih,Eg,Gg),If=W(Cf,Jh,Ng,Pg),c||(Th.scale(Df),Ve&&Xh.scale(Af)),Q()}function Q(){of=zb(),pf=Ab(),qf=Ab(.98)}function R(a,b,e,f){var g=(xh?Je.time.scale():Je.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),yh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function S(a,b){return Je.scale.linear().range([a,b])}function T(a){return"y2"===X(a)?Cf:Bf}function U(a){return"y2"===X(a)?Ff:Ef}function V(a,b,c,d){var e=(yh?xb():Je.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),yh?e.tickCentered(qg):e.tickOffset=function(){var a=ng?ef:cf;return a*Rb()/pc()/2},yh&&e.categories(pg),e}function W(a,b,c,d){return Je.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function X(a){re
|
|
|
|
c.classed(Ne)&&d(!1,c.classed(Ne,!1),a,b)}),e.classed(Ne,!f),d(!f,e,b,c)),_f(b,a))}function qe(a){var b,c,d,e,f,g,h,i;Cd(Ke.data.targets)||Xf&&(!Ve||Xh.altDomain)&&$f&&(b=Ah[0],c=Ah[1],d=a[0],e=a[1],f=Math.min(b,d),g=Math.max(b,d),h=Yf?_e.top:Math.min(c,e),i=Yf?ef:Math.max(c,e),$h.select("."+Pe.dragarea).attr("x",f).attr("y",h).attr("width",g-f).attr("height",i-h),$h.selectAll("."+Pe.shapes).selectAll("."+Pe.shape).filter(function(a){return Zf(a)}).each(function(a,b){var c,d,e,j,k,l,m=Je.select(this),n=m.classed(Ne),o=m.classed(Oe),p=!1;"circle"===this.nodeName?(c=1*m.attr("cx"),d=1*m.attr("cy"),k=Xd,p=c>f&&g>c&&d>h&&i>d):"path"===this.nodeName&&(l=hd(this),c=l.x,d=l.y,e=l.width,j=l.height,k=$d,p=!(c>g||f>c+e||d>i||h>d+j)),p^o&&(m.classed(Oe,!o),m.classed(Ne,!n),k(!n,m,a,b))}))}function re(a){Cd(Ke.data.targets)||Xf&&(Ah=a,$h.select("."+Pe.chart).append("rect").attr("class",Pe.dragarea).style("opacity",.1),Bh=!0,eg())}function se(){Cd(Ke.data.targets)||Xf&&($h.select("."+Pe.dragarea).transition().duration(100).style("opacity",0).remove(),$h.selectAll("."+Pe.shape).classed(Oe,!1),Bh=!1,fg())}function te(a){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=rd(),I=Cd(Ke.data.targets),K=vc(Ke.data.targets);if(0!==K.length){if(a=d(a)?a:{},t=d(a.withY)?a.withY:!0,u=d(a.withSubchart)?a.withSubchart:!0,v=d(a.withTransition)?a.withTransition:!0,w=d(a.withTransform)?a.withTransform:!1,x=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,y=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,z=d(a.withLegend)?a.withLegend:!1,E=v?$e:0,F=d(a.durationForExit)?a.durationForExit:E,G=d(a.durationForAxis)?a.durationForAxis:E,z&&jg&&Fe(Ke.data.targets,a),y&&(Af.domain(Je.extent(Vb(K))),di=Af.domain(),Ve&&Xh.scale(Af).updateScaleExtent(),Df.domain(Af.domain()),Th.scale(Df)),x&&(Af.domain(Th.empty()?di:Th.extent()),Ve&&Xh.scale(Af).updateScaleExtent()),Bf.domain(Qb(K,"y")),Cf.domain(Qb(K,"y2")),$h.select("."+Pe.axisX).style("opacity",I?0:1).transition().duration(G).call(Gf),$h.select("."+Pe.axisY).style("opacity",I?0:1).transition().duration(G).call(Hf),$h.select("."+Pe.axisY2).style("opacity",I?0:1).transition().duration(G).call(If),A=ge(H),C=he(H,!0),D=he(H,!1),$h.select("."+Pe.axisX+" ."+Pe.axisXLabel).attr("x",kb),$h.select("."+Pe.axisY+" ."+Pe.axisYLabel).attr("x",lb).attr("dy",rb),$h.select("."+Pe.axisY2+" ."+Pe.axisY2Label).attr("x",mb).attr("dy",sb),Ef.domain(Bf.domain()),Ff.domain(Cf.domain()),bi.style("display","none"),$h.select("line."+Pe.xgridFocus).style("visibility","hidden"),Qg){if("year"===Rg){e=[];for(var L=Vb(),M=L[0].getFullYear(),N=L[1].getFullYear(),O=M;N>=O;O++)e.push(new Date(O+"-01-01 00:00:00"))}else e=Af.ticks(10);c=$h.select("."+Pe.xgrids).selectAll("."+Pe.xgrid).data(e),c.enter().append("line").attr("class",Pe.xgrid),c.attr("x1",ng?0:function(a){return Af(a)-Gf.tickOffset()}).attr("x2",ng?cf:function(a){return Af(a)-Gf.tickOffset()}).attr("y1",ng?function(a){return Af(a)-Gf.tickOffset()}:_e.top).attr("y2",ng?function(a){return Af(a)-Gf.tickOffset()}:ef).style("opacity",function(){return+Je.select(this).attr(ng?"y1":"x1")===(ng?ef:0)?0:1}),c.exit().remove()}Sd(Sg)&&(f=$h.select("."+Pe.xgridLines).selectAll("."+Pe.xgridLine).data(Sg),g=f.enter().append("g").attr("class",function(a){return Pe.xgridLine+(a.class?a.class:"")}),g.append("line").style("opacity",0),g.append("text").attr("text-anchor","end").attr("transform",ng?"":"rotate(-90)").attr("dx",ng?0:-_e.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(E).attr("x1",ng?0:$c).attr("x2",ng?cf:$c).attr("y1",ng?$c:_e.top).attr("y2",ng?$c:ef).style("opacity",1),f.select("text").transition().duration(E).attr("x",ng?cf:0).attr("y",$c).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(E).style("opacity",0).remove()),t&&Tg&&(h=$h.select("."+Pe.ygrids).selectAll("."+Pe.ygrid).data(Bf.ticks(Vg)),h.enter().append("line").attr("class",Pe.ygrid),h.attr("x1",ng?Bf:0).attr("x2",ng?Bf:cf).attr("y1",ng?0:Bf).attr("y2",ng?ef:Bf),h.exit().remove()),t&&Sd(Ug)&&(i=$h.select("."+Pe.ygridLines).selectAll("."+Pe.ygrid
|