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