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