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