Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

3 lines
79 KiB

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