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