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