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