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