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