diff --git a/c3.js b/c3.js index 0330f2d..6ea3ae3 100644 --- a/c3.js +++ b/c3.js @@ -475,7 +475,7 @@ function getEventRectWidth() { var base = __axis_rotated ? height : width, maxDataCount = getMaxDataCount(), - ratio = getXDomainRatio() * (hasBarType(c3.data.targets) ? (maxDataCount - 1) / maxDataCount : 0.98); + ratio = getXDomainRatio() * (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 0.98); return maxDataCount > 1 ? (base * ratio) / (maxDataCount - 1) : base; } function updateLegndStep(step) { @@ -3014,7 +3014,7 @@ .attr('height', height); // exit : not needed becuase always only one rect exists } else { - if (isCustomX) { + if (isCustomX && !isCategorized) { rectW = function (d, i) { var prevX = getPrevX(i), nextX = getNextX(i); return (x(nextX ? nextX : d.x + 50) - x(prevX ? prevX : d.x - 50)) / 2; diff --git a/c3.min.js b/c3.min.js index 5453182..3076645 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,2 +1,2 @@ -!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}var e={};e.generate=function(e){function f(a,b){if(!(a in e))throw Error(b)}function g(a,b){for(var c=e,d=0;dWe&&(We=0),0>Ye&&(Ye=0),Ue={top:dg?Te.top:_e-Zf-(yh?0:af),right:0/0,bottom:20+(yh?0:af),left:dg?Ch:Te.left},Xe=dg?Te.left-Ch-Dh:We,Ze=dg?Ye:_e-Ue.top-Ue.bottom,0>Xe&&(Xe=0),0>Ze&&(Ze=0),Ve={top:yh?0:_e-af,right:0/0,bottom:0,left:yh?$e-bf:0},n(),yh&&vd(Ce.data.targets)&&(Ve.left=We/2+df)}function n(){df=Ye/2,cf=.95*df,ef=ud(Ce.data.targets)?.6*cf:0}function o(){var a=dg?He.axisX:He.axisY,b=Be.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Be.select(Ie).node().getBoundingClientRect(),e=c.right-d.left-r();return e>0?e:0}function p(){return Je?Je:v()}function q(){var a=Ke?Ke:w();return a>0?a:320}function r(){return vd(Ce.data.targets)?0:Le?Le:dg||!og||tg?1:t("y")}function s(){var a=1;return vd(Ce.data.targets)?0:Me?Me:yh?bf+(xg&&!dg?t("y2"):a):xg?Cg||dg?a:t("y2"):a}function t(a){var b=db(a);return b.isInner?20+wb(a):40+wb(a)}function u(a){return"y"!==a||og?"y2"!==a||xg?(db(a).isInner?30:40)+("y2"===a?-10:0):Eh:_f&&!yh?10:1}function v(){return+Be.select(Ie).style("width").replace("px","")}function w(){return+Be.select(Ie).style("height").replace("px","")}function x(a){return a?-5:-(Te.left-1)}function y(a){return a?-20:-1}function z(){return x(!dg)}function A(){return y(!dg)}function B(){return x(dg)}function C(){return y(dg)}function D(a){return a?We+2+4:Te.left+20}function E(a){return a?80:Ye+2}function F(){return D(!dg)}function G(){return E(!dg)}function H(){return D(dg)}function I(){return E(dg)}function J(){var a=dg?Ye:We,b=mc(),c=Rb()*(rd(Ce.data.targets)?(b-1)/b:.98);return b>1?a*c/(b-1):a}function K(a){zh=a}function L(a){Ah=a}function M(a){Bh=a}function N(){return _f?yh?Ah*(zh+1):$e:0}function O(){return _f?yh?_e:Bh*(zh+1):0}function P(){var a,b,c=!sf;kf=dg?1:0,lf=dg?Ye:We,mf=dg?0:Ye,nf=dg?We:1,of=kf,pf=lf,qf=dg?0:Ze,rf=dg?Xe:1,sf=R(kf,lf,c?void 0:sf.domain(),function(){return yf.tickOffset()}),tf=S(mf,nf),uf=S(mf,nf),vf=R(kf,lf,Rh,function(a){return a%1?0:Bf.tickOffset()}),wf=S(qf,rf),xf=S(qf,rf),a=Y(),b=Z(),yf=V(sf,th,a,b),Bf=V(vf,wh,a,b),zf=W(tf,uh,ug,wg),Af=W(uf,vh,Dg,Fg),c||(Fh.scale(vf),Ne&&Jh.scale(sf)),Q()}function Q(){ff=zb(),gf=Ab(),hf=Ab(.98)}function R(a,b,e,f){var g=(lh?Be.time.scale():Be.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function S(a,b){return Be.scale.linear().range([a,b])}function T(a){return"y2"===X(a)?uf:tf}function U(a){return"y2"===X(a)?xf:wf}function V(a,b,c,d){var e=(mh?xb():Be.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),mh?e.tickCentered(gg):e.tickOffset=function(){var a=dg?Ye:We;return a*Rb()/mc()/2},mh&&e.categories(fg),e}function W(a,b,c,d){return Be.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function X(a){return a in If?If[a]:"y"}function Y(){var a=lh?sh:mh?vc:null;return hg&&("function"==typeof hg?a=hg:lh&&(a=function(a){return Be.time.format(hg)(a)})),a}function Z(){var a=mc();return ig&&a>jg?jg:a}function $(a){return"string"==typeof a?a:a?a.text:null}function _(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function ab(){return _(ng,dg?"inner-top":"inner-right")}function bb(){return _(sg,dg?"inner-right":"inner-top")}function cb(){return _(Bg,dg?"inner-right":"inner-top")}function db(a){return"y2"===a?cb():"y"===a?bb():ab()}function eb(){return $(ng)}function fb(){return $(sg)}function gb(){return $(Bg)}function hb(a,b){return a?b.isLeft?0:b.isCenter?We/2:We:b.isBottom?-Ye:b.isMiddle?-Ye/2:0}function ib(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function jb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function kb(){return hb(!dg,ab())}function lb(){return hb(dg,bb())}function mb(){return hb(dg,cb())}function nb(){return ib(!dg,ab())}function ob(){return ib(dg,bb())}function pb(){return ib(dg,cb())}function qb(){var a=ab();return dg?a.isInner?"1.2em":-30-wb("x"):a.isInner?"-0.5em":"3em"}function rb(){var a=bb();return dg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-wb("y")}function sb(){var a=cb();return dg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+wb("y2")}function tb(){return jb(!dg,ab())}function ub(){return jb(dg,bb())}function vb(){return jb(dg,cb())}function wb(a){var b=0,c="x"===a?He.axisX:"y"===a?He.axisY:He.axisY2;return Be.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(f=tc(a),b=0;ba?a:0}),c=1;c0||(g[d][b]+=+a)});return Be.min(Object.keys(g).map(function(a){return Be.min(g[a])}))}function Pb(a){var b,c,d,e,f,g=rc(a);if(Hf.length>0)for(f=uc(a),b=0;b0?a:0}),c=1;c+a||(g[d][b]+=+a)});return Be.max(Object.keys(g).map(function(a){return Be.max(g[a])}))}function Qb(a){var c,d,e,f,g,h,i,j,k=qc(function(b){return X(b.id)===a}),l="y2"===a?zg:qg,m="y2"===a?yg:pg,n=b(l)?l:Ob(k),o=b(m)?m:Pb(k),p="y2"===a?Ag:rg,q=Qc()&&dg;return n===o&&(0>n?o=0:n=0),c=Math.abs(o-n),d=e=f=q?0:.1*c,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&vg&&(e=b(vg.top)?vg.top:d,f=b(vg.bottom)?vg.bottom:d),"y2"===a&&Eg&&(e=b(Eg.top)?Eg.top:d,f=b(Eg.bottom)?Eg.bottom:d),q&&(h=Rc(n,o),i=Wb(tf.range()),j=[h[0]/i,h[1]/i],e+=c*(j[1]/(1-j[0]-j[1])),f+=c*(j[0]/(1-j[0]-j[1]))),rd(k)&&!tc(k)&&(f=n),[n-f,o+e]}function Rb(a){var b=Wb(Rh),c=Wb(sf.domain());return a||0===c?1:b/c}function Sb(a){return lg?lg:Be.min(a,function(a){return Be.min(a.values,function(a){return a.x})})}function Tb(a){return kg?kg:Be.max(a,function(a){return Be.max(a.values,function(a){return a.x})})}function Ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mh?d=0:rd(a)?(c=mc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Vb(a){var b=[Sb(a),Tb(a)],c=b[0],d=b[1],e=Ub(a,b),f=lh?new Date(c.getTime()-e):c-e,g=lh?new Date(d.getTime()+e):d+e;return[f,g]}function Wb(a){return a[1]-a[0]}function Xb(a){for(var b=0;bd?0:d}function ac(a){return Cf&&a===Cf||Df&&Ld(Df,a)}function bc(a){return!ac(a)}function cc(a){return Cf?Cf:Df?Df[a]:null}function dc(a,b){return a in Ce.data.x&&Ce.data.x[a]&&Ce.data.x[a][b]?Ce.data.x[a][b]:b}function ec(a){Object.keys(a).forEach(function(b){Df[b]=a[b]})}function fc(a){var b;return a&&(b=Gf[a.id],a.name=b?b:a.id),a}function gc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?a.map(function(a){return a[c]}):Ce.data.x[Object.keys(Ce.data.x)[0]]}),b=c.map(function(b,c){var d=Ff(b);return{id:d,id_org:b,values:a.map(function(a,e){var f,g=cc(b);return lh?f=a[g]instanceof Date?a[g]:Hd(a[g]):nh&&!mh?f=a[g]?+a[g]:dc(b,e):nh&&mh?(f=e,0===c&&a[g]&&(0===e&&(fg=[]),fg.push(a[g]))):f=e,a.x=f,{x:f,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}})}}),b.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++})}),Jf&&pd(oc(b).filter(function(a){return!(a in Kf)}),Jf),b.forEach(function(a){Yb(a.id_org,a)}),b}function jc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function kc(a){return a>0&&Ce.data.targets[0].values[a-1]?Ce.data.targets[0].values[a-1].x:void 0}function lc(a){return a1?Ce.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ce.data.targets[0]:null,a}function oc(a){return a=c(a)?Ce.data.targets:a,a.map(function(a){return a.id})}function pc(a){var b,c=oc();for(b=0;ba})}function uc(a){return sc(a,function(a){return a>0})}function vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(Yc(a,f))),a[g].x&&(e=e.concat(Yc(a,g))),_c(e,b)):Zc(a,b,f,g)}function $c(a,b){var c;return c=a.map(function(a){return Zc(a.values,b)}),_c(c,b)}function _c(a,b){var c,d;return a.forEach(function(a){var e=Md(a,b);(c>e||!c)&&(c=e,d=a)}),d}function ad(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 bd(){return Mf&&"desc"===Mf.toLowerCase()}function cd(){return Mf&&"asc"===Mf.toLowerCase()}function dd(a){var b=cd(),c=bd();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 Mf&&a.sort(Mf),a}function ed(a,c){var d,e,f,g,h,i,j,k=vd(Ce.data.targets),l=k?Xc:Wc,m=a.filter(function(a){return a&&b(a.value)});ch&&0!==m.length&&(Ph.html(fh(a,Y(),l,rh)).style("display","block"),d=Ph.property("offsetWidth"),e=Ph.property("offsetHeight"),k?(g=We/2+c[0],i=Ye/2+c[1]+20):(dg?(f=o(),g=f+c[0]+100,h=g+d,j=p()-s(),i=sf(m[0].x)+20):(f=o(),g=f+r()+sf(m[0].x)+20,h=g+d,j=f+p()-s(),i=c[1]+15),h>j&&(g-=d+60),i+e>q()&&(i-=e+30)),Ph.style("top",i+"px").style("left",g+"px"))}function fd(){Ph.style("display","none")}function gd(a){var c=a.filter(function(a){return a&&b(a.value)});ch&&(sd(Ce.data.targets)||vd(Ce.data.targets)||Mh.selectAll("line."+He.xgridFocus).style("visibility","visible").data([c[0]]).attr(dg?"y1":"x1",Sc).attr(dg?"y2":"x2",Sc))}function hd(){Mh.select("line."+He.xgridFocus).style("visibility","hidden")}function id(a){return a.x||0===a.x?sf(a.x):null}function jd(a){return T(a.id)(a.value)}function kd(){var a,b,d={},e=0;return qc(yd).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function od(a,b){return b?2*a.tickOffset()*.6/b:0}function pd(a,b){var d=c(a)?oc():a;"string"==typeof d&&(d=[d]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function de(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function ee(b){var c,d,e;if(Qh=Be.select(Ie),Qh.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qh.html(""),Qh.classed("c3",!0),Ce.data.x={},Ce.data.targets=ic(b),m(),P(),sf.domain(Be.extent(Vb(Ce.data.targets))),tf.domain(Qb("y")),uf.domain(Qb("y2")),vf.domain(sf.domain()),wf.domain(tf.domain()),xf.domain(uf.domain()),Rh=sf.domain(),Fh.scale(vf),Ne&&Jh.scale(sf),Kh=Qh.append("svg").attr("width",We+Te.left+Te.right).attr("height",Ye+Te.top+Te.bottom).on("mouseenter",Qe).on("mouseleave",Re),Lh=Kh.append("defs"),Lh.append("clipPath").attr("id",jh).append("rect").attr("width",We).attr("height",Ye),Lh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",z).attr("y",A).attr("width",F).attr("height",G),Lh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Mh=Kh.append("g").attr("transform",xh.main),Nh=Yf?Kh.append("g").attr("transform",xh.context):null,Oh=_f?Kh.append("g").attr("transform",xh.legend):null,Ph=Be.select(Ie).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Mh.append("g").attr("class",He.axisX).attr("clip-path",dg?"":h("xaxis-clip")).attr("transform",xh.x).append("text").attr("class",He.axisXLabel).attr("transform",dg?"rotate(-90)":"").attr("dx",nb).attr("dy",qb).style("text-anchor",tb).text(eb),og&&Mh.append("g").attr("class",He.axisY).attr("clip-path",dg?h("yaxis-clip"):"").append("text").attr("class",He.axisYLabel).attr("transform",dg?"":"rotate(-90)").attr("dx",ob).attr("dy",rb).style("text-anchor",ub).text(fb),xg&&Mh.append("g").attr("class",He.axisY2).attr("transform",xh.y2).append("text").attr("class",He.axisY2Label).attr("transform",dg?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(gb),d=Mh.append("g").attr("clip-path",kh).attr("class",He.grid),Gg&&d.append("g").attr("class",He.xgrids),Ig&&d.append("g").attr("class",He.xgridLines),Og&&d.append("g").attr("class",He.xgridFocus).append("line").attr("class",He.xgridFocus).attr("x1",dg?0:-10).attr("x2",dg?We:-10).attr("y1",dg?-10:Te.top).attr("y2",dg?-10:Ye),Jg&&d.append("g").attr("class",He.ygrids),Kg&&d.append("g").attr("class",He.ygridLines),Mh.append("g").attr("clip-path",kh).attr("class",He.regions),Mh.append("g").attr("clip-path",kh).attr("class",He.chart),c=Mh.select("."+He.chart).append("g").attr("class",He.eventRects).style("fill-opacity",0).style("cursor",Ne?dg?"ns-resize":"ew-resize":null),Mh.select("."+He.chart).append("g").attr("class",He.chartBars),Mh.select("."+He.chart).append("g").attr("class",He.chartLines),Mh.select("."+He.chart).append("g").attr("class",He.chartArcs).attr("transform",xh.arc).append("text").attr("class",He.chartArcsTitle).style("text-anchor","middle").text(Kb()),Mh.select("."+He.chart).append("g").attr("class",He.chartTexts),Ne&&Mh.insert("rect",Pe?null:"g.grid").attr("class",He.zoomRect).attr("width",We).attr("height",Ye).style("opacity",0).style("cursor",dg?"ns-resize":"ew-resize").call(Jh).on("dblclick.zoom",null),null!==mg&&Fh.extent("function"!=typeof mg?mg:mg(Vb())),Yf&&(Nh.append("g").attr("clip-path",kh).attr("class",He.chart),Nh.select("."+He.chart).append("g").attr("class",He.chartBars),Nh.select("."+He.chart).append("g").attr("class",He.chartLines),Nh.append("g").attr("clip-path",kh).attr("class",He.brush).call(Fh).selectAll("rect").attr(dg?"width":"height",dg?Xe:Ze),Nh.append("g").attr("class",He.axisX).attr("transform",xh.subx).attr("clip-path",dg?"":h("xaxis-clip"))),re(Ce.data.targets),dg?Mh.select("."+He.axisX).style("opacity",0).call(yf):(Mh.select("."+He.axisY).style("opacity",0).call(zf),Mh.select("."+He.axisY2).style("opacity",0).call(Af)),qe({withTransform:!0,withLegend:!0,durationForAxis:0}),gh){if(lh&&"string"==typeof hh){for(hh=Hd(hh),e=0;e0){d=[];for(var f in Gf)for(c=0;cf&&g>c&&d>h&&i>d):"path"===this.nodeName&&(l=ad(this),c=l.x,d=l.y,e=l.width,j=l.height,k=Sd,p=!(c>g||f>c+e||d>i||h>d+j)),p^o&&(m.classed(Ge,!o),m.classed(Fe,!n),k(!n,m,a,b))}))}function je(a){vd(Ce.data.targets)||Pf&&(oh=a,Mh.select("."+He.chart).append("rect").attr("class",He.dragarea).style("opacity",.1),ph=!0,Wf())}function ke(){vd(Ce.data.targets)||Pf&&(Mh.select("."+He.dragarea).transition().duration(100).style("opacity",0).remove(),Mh.selectAll("."+He.shape).classed(Ge,!1),ph=!1,Xf())}function le(a){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=kd(),I=vd(Ce.data.targets); -if(a=d(a)?a:{},t=d(a.withY)?a.withY:!0,u=d(a.withSubchart)?a.withSubchart:!0,v=d(a.withTransition)?a.withTransition:!0,w=d(a.withTransform)?a.withTransform:!1,x=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,y=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,z=d(a.withLegend)?a.withLegend:!1,E=v?Se:0,F=d(a.durationForExit)?a.durationForExit:E,G=d(a.durationForAxis)?a.durationForAxis:E,z&&_f&&xe(Ce.data.targets,a),y&&(sf.domain(Be.extent(Vb(Ce.data.targets))),Rh=sf.domain(),Ne&&Jh.scale(sf).updateScaleExtent(),vf.domain(sf.domain()),Fh.scale(vf)),x&&(sf.domain(Fh.empty()?Rh:Fh.extent()),Ne&&Jh.scale(sf).updateScaleExtent()),tf.domain(Qb("y")),uf.domain(Qb("y2")),Mh.select("."+He.axisX).style("opacity",I?0:1).transition().duration(G).call(yf),Mh.select("."+He.axisY).style("opacity",I?0:1).transition().duration(G).call(zf),Mh.select("."+He.axisY2).style("opacity",I?0:1).transition().duration(G).call(Af),A=$d(H),C=_d(H,!0),D=_d(H,!1),Mh.select("."+He.axisX+" ."+He.axisXLabel).attr("x",kb),Mh.select("."+He.axisY+" ."+He.axisYLabel).attr("x",lb).attr("dy",rb),Mh.select("."+He.axisY2+" ."+He.axisY2Label).attr("x",mb).attr("dy",sb),wf.domain(tf.domain()),xf.domain(uf.domain()),Ph.style("display","none"),Mh.select("line."+He.xgridFocus).style("visibility","hidden").attr("y2",Ye),Gg){if("year"===Hg){e=[];for(var K=Vb(),L=K[0].getFullYear(),M=K[1].getFullYear(),N=L;M>=N;N++)e.push(new Date(N+"-01-01 00:00:00"))}else e=sf.ticks(10);c=Mh.select("."+He.xgrids).selectAll("."+He.xgrid).data(e),c.enter().append("line").attr("class",He.xgrid),c.attr("x1",dg?0:function(a){return sf(a)-yf.tickOffset()}).attr("x2",dg?We:function(a){return sf(a)-yf.tickOffset()}).attr("y1",dg?function(a){return sf(a)-yf.tickOffset()}:Te.top).attr("y2",dg?function(a){return sf(a)-yf.tickOffset()}:Ye).style("opacity",function(){return+Be.select(this).attr(dg?"y1":"x1")===(dg?Ye:0)?0:1}),c.exit().remove()}Ig&&(f=Mh.select("."+He.xgridLines).selectAll("."+He.xgridLine).data(Ig),g=f.enter().append("g").attr("class",function(a){return He.xgridLine+(a.class?a.class:"")}),g.append("line").style("opacity",0),g.append("text").attr("text-anchor","end").attr("transform",dg?"":"rotate(-90)").attr("dx",dg?0:-Te.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(E).attr("x1",dg?0:Tc).attr("x2",dg?We:Tc).attr("y1",dg?Tc:Te.top).attr("y2",dg?Tc:Ye).style("opacity",1),f.select("text").transition().duration(E).attr("x",dg?We:0).attr("y",Tc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(E).style("opacity",0).remove()),t&&Jg&&(h=Mh.select("."+He.ygrids).selectAll("."+He.ygrid).data(tf.ticks(Lg)),h.enter().append("line").attr("class",He.ygrid),h.attr("x1",dg?tf:0).attr("x2",dg?tf:We).attr("y1",dg?0:tf).attr("y2",dg?Ye:tf),h.exit().remove()),t&&Kg&&(i=Mh.select("."+He.ygridLines).selectAll("."+He.ygridLine).data(Kg),j=i.enter().append("g").attr("class",function(a){return He.ygridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",dg?"rotate(-90)":"").attr("dx",dg?0:-Te.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(E).attr("x1",dg?Uc:0).attr("x2",dg?Uc:We).attr("y1",dg?0:Uc).attr("y2",dg?Ye:Uc).style("opacity",1),i.select("text").transition().duration(E).attr("x",dg?0:We).attr("y",Uc).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(E).style("opacity",0).remove()),l=Mh.selectAll("."+He.bars).selectAll("."+He.bar).data(Dd),l.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return rh(a.id)}).attr("class",Ec),l.style("opacity",Mc).transition().duration(E).attr("d",A).style("opacity",1),l.exit().transition().duration(F).style("opacity",0).remove(),n=Mh.selectAll("."+He.texts).selectAll("."+He.text).data(Fd),n.enter().append("text").attr("class",xc).attr("text-anchor",function(a){return dg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Wc(a.value)}),n.style("fill-opacity",Nc).transition().duration(E).attr("x",C).attr("y",D).style("fill-opacity",Pc),n.exit().transition().duration(F).style("fill-opacity",0).remove(),Mh.selectAll("."+He.line).style("opacity",Mc).transition().duration(E).attr("d",Gh).style("opacity",1),Mh.selectAll("."+He.area).style("opacity",0).transition().duration(E).attr("d",Hh).style("opacity",Sh),k=Mh.selectAll("."+He.circles).selectAll("."+He.circle).data(Ed),k.enter().append("circle").attr("class",Cc).style("opacity",0).attr("r",Ng),k.style("opacity",Mc).transition().duration(E).style("opacity",Oc).attr("cx",dg?jd:id).attr("cy",dg?id:jd),k.exit().remove(),Mh.selectAll("."+He.chartArc).select("."+He.arc).attr("transform",w?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(E).attrTween("d",function(a){var b=yb(a);if(!b)return function(){return"M 0 0"};var c=Be.interpolate(this._current,b);return this._current=c(0),function(a){return Bb(c(a),!0)}}).attr("transform",w?"scale(1)":"").style("opacity",1),Mh.selectAll("."+He.chartArc).select("text").attr("transform",Cb).style("opacity",0).transition().duration(E).text(Fb).style("opacity",function(a){return Cd(a.data)?1:0}),Mh.select("."+He.chartArcsTitle).style("opacity",ud(Ce.data.targets)?1:0),Yf&&(null!==Be.event&&"zoom"===Be.event.type&&Fh.extent(sf.orgDomain()).update(),u&&(Nh.select("."+He.axisX).style("opacity",I?0:1).transition().duration(E).call(Bf),Fh.empty()||Fh.extent(sf.orgDomain()).update(),B=$d(H,!0),o=Nh.selectAll("."+He.bars).selectAll("."+He.bar).data(Dd),o.enter().append("path").attr("d",B).style("stroke","none").style("fill",function(a){return rh(a.id)}).attr("class",Ec),o.style("opacity",Mc).transition().duration(E).attr("d",B).style("opacity",1),o.exit().transition().duration(E).style("opacity",0).remove(),Nh.selectAll("."+He.line).style("opacity",Mc).transition().duration(E).attr("d",Ih).style("opacity",1))),Mh.selectAll("."+He.selectedCircles).filter(function(a){return yd(a)}).selectAll("circle").remove(),Mh.selectAll("."+He.selectedCircle).transition().duration(E).attr("cx",dg?jd:id).attr("cy",dg?id:jd),Df?(p=Mh.select("."+He.eventRects).selectAll("."+He.eventRect).data([0]),ge(p.enter()),p.attr("x",0).attr("y",0).attr("width",We).attr("height",Ye)):(nh?(s=function(a,b){var c=kc(b),d=lc(b);return(sf(d?d:a.x+50)-sf(c?c:a.x-50))/2},r=function(a,b){var c=kc(b);return(sf(a.x)+sf(c?c:a.x-50))/2}):(s=J(),r=function(a){return sf(a.x)-s/2}),q=nc(),Mh.select("."+He.eventRects).datum(q?q.values:[]),p=Mh.select("."+He.eventRects).selectAll("."+He.eventRect).data(function(a){return a}),fe(p.enter()),p.attr("class",Jc).attr("x",dg?0:r).attr("y",dg?r:0).attr("width",dg?We:s).attr("height",dg?s:Ye),p.exit().remove()),m=Mh.select("."+He.regions).selectAll("rect."+He.region).data(bh),m.enter().append("rect").style("fill-opacity",0),m.attr("class",Ic).attr("x",dg?0:$b).attr("y",dg?$b:Te.top).attr("width",dg?We:_b).attr("height",dg?_b:Ye).transition().duration(E).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),m.exit().transition().duration(E).style("fill-opacity",0).remove(),oc().forEach(function(a){Th[a]=!0})}function me(){le({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function ne(){return"mousemove"===Be.event.sourceEvent.type&&Jh.altDomain?(sf.domain(Jh.altDomain),void Jh.scale(sf).updateScaleExtent()):(mh&&sf.orgDomain()[0]===Rh[0]&&sf.domain([Rh[0]-1e-10,sf.orgDomain()[1]]),le({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Be.event.sourceEvent.type&&(qh=!0)))}function oe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pe(){Kh.attr("width",$e).attr("height",_e),Kh.select("#"+jh).select("rect").attr("width",We).attr("height",Ye),Kh.select("#xaxis-clip").select("rect").attr("width",F),Kh.select("#yaxis-clip").select("rect").attr("width",H),Kh.select("."+He.zoomRect).attr("width",We).attr("height",Ye)}function qe(a){a=d(a)?a:{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.durationForExit=0,m(),P(),pe(),l(a.withTransition),le(a)}function re(a){var b,c,d,e,f,g,h,i,j,k,l,m;h=Mh.select("."+He.chartTexts).selectAll("."+He.chartText).data(a),i=h.enter().append("g").attr("class",function(a){return He.chartText+wc(He.target,a.id)}).style("pointer-events","none"),i.append("g").attr("class",yc).style("fill",function(a){return rh(a.id)}),e=Mh.select("."+He.chartBars).selectAll("."+He.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return He.chartBar+wc(He.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Fc).style("fill",function(a){return rh(a.id)}).style("stroke","none").style("cursor",function(a){return Rf(a)?"pointer":null}),c=Mh.select("."+He.chartLines).selectAll("."+He.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return He.chartLine+wc(He.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Bc).style("opacity",0).style("stroke",function(a){return rh(a.id)}),b.append("path").attr("class",Hc).style("opacity",function(){return Sh=+Be.select(this).style("opacity"),0}).style("fill",function(a){return rh(a.id)}),b.append("g").attr("class",function(a){return wc(He.selectedCircles,a.id)}),b.append("g").attr("class",Dc).style("fill",function(a){return rh(a.id)}).style("cursor",function(a){return Rf(a)?"pointer":null}),a.forEach(function(a){Mh.selectAll("."+He.selectedCircles+Kc(a.id)).selectAll("."+He.selectedCircle).each(function(b){b.value=a.values[b.x].value})}),g=Mh.select("."+He.chartArcs).selectAll("."+He.chartArc).data(jf(a)),f=g.enter().append("g").attr("class",function(a){return He.chartArc+wc(He.target,a.data.id)}),f.append("path").attr("class",Gc).style("opacity",0).style("fill",function(a){return rh(a.data.id)}).style("cursor",function(a){return Rf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Eb(a),d=Mb();Gb(a.data.id),ue(a.data.id),d(c,b)}).on("mousemove",function(a){var b=[Eb(a)];ed(b,Be.mouse(this))}).on("mouseout",function(a,b){var c=Eb(a),d=Nb();Hb(a.data.id),we(),fd(),d(c,b)}).on("click",function(a,b){var c=Eb(a),d=Lb();d(c,b)}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Yf&&(m=Nh.select("."+He.chartBars).selectAll("."+He.chartBar).data(a),l=m.enter().append("g").attr("class",function(a){return He.chartBar+wc(He.target,a.id)}),l.append("g").attr("class",Fc).style("fill",function(a){return rh(a.id)}),k=Nh.select("."+He.chartLines).selectAll("."+He.chartLine).data(a),j=k.enter().append("g").attr("class",function(a){return He.chartLine+wc(He.target,a.id)}),j.append("path").attr("class",Bc).style("opacity",0).style("stroke",function(a){return rh(a.id)})),Kh.selectAll("."+He.target).transition().style("opacity",1)}function se(a,b){Ce.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+r)/10),i=10*Math.ceil((g.height+q)/10),j=yh?i:h,k=yh?af:bf;c&&(v=0,B=0,s=0,t=0),x[b]=h,y[b]=i,(!s||h>=s)&&(s=h),(!t||i>=t)&&(t=i),f=yh?t:s,cg?(Object.keys(x).forEach(function(a){x[a]=s}),Object.keys(y).forEach(function(a){y[a]=t}),e=(k-f*p.length)/2,u>e?(v=0,B=0,p.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,n,o,p=oc(a),q=4,r=26,s=0,t=0,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=c(b)?{}:b,o=d(b.withTransition)?b.withTransition:!0,yh?(g=function(a){return s*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return t*(.2+A[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},n=function(a,b){return j(a,b)-7},f=Oh.selectAll("."+He.legendItem).data(p).enter().append("g").attr("class",function(a){return wc(He.legendItem,a)}).style("cursor","pointer").on("click",function(a){bg(a)}).on("mouseover",function(a){Ce.focus(a)}).on("mouseout",function(){Ce.revert()}),f.append("text").text(function(a){return d(Gf[a])?Gf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",yh?h:-200).attr("y",yh?-200:k),f.append("rect").attr("class",He.legendItemEvent).style("fill-opacity",0).attr("x",yh?i:-200).attr("y",yh?-200:n).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class",He.legendItemTile).style("pointer-events","none").style("fill",function(a){return rh(a)}).attr("x",yh?h:-200).attr("y",yh?-200:j).attr("width",10).attr("height",10),Oh.selectAll("text").data(p).each(function(a,b){e(this,a,0===b)}).transition().duration(o?250:0).attr("x",h).attr("y",k),Oh.selectAll("rect."+He.legendItemEvent).data(p).transition().duration(o?250:0).attr("x",i).attr("y",n),Oh.selectAll("rect."+He.legendItemTile).data(p).transition().duration(o?250:0).attr("x",g).attr("y",j),L(s),M(t),K(B),m(),P(),pe(),l(!1)}function ye(a){return pc(a.id)}function ze(a){return"data"in a&&pc(a.data.id)}function Ae(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}}var Be=a.d3?a.d3:a.require?a.require("d3"):void 0,Ce={data:{}},De={},Ee="_expanded_",Fe="_selected_",Ge="_included_",He={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",dragarea:"c3-dragarea"},Ie=g(["bindto"],"#chart"),Je=g(["size","width"],null),Ke=g(["size","height"],null),Le=g(["padding","left"],null),Me=g(["padding","right"],null),Ne=g(["zoom","enabled"],!1),Oe=g(["zoom","extent"],null),Pe=g(["zoom","privileged"],!1),Qe=g(["onenter"],function(){}),Re=g(["onleave"],function(){}),Se=g(["transition","duration"],350);f("data","data is required in config");var Te,Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf=g(["data","x"],null),Df=g(["data","xs"],null),Ef=g(["data","x_format"],"%Y-%m-%d"),Ff=g(["data","id_converter"],function(a){return a}),Gf=g(["data","names"],{}),Hf=g(["data","groups"],[]),If=g(["data","axes"],{}),Jf=g(["data","type"],null),Kf=g(["data","types"],{}),Lf=g(["data","labels"],{}),Mf=g(["data","order"],null),Nf=g(["data","regions"],{}),Of=g(["data","colors"],{}),Pf=g(["data","selection","enabled"],!1),Qf=g(["data","selection","grouped"],!1),Rf=g(["data","selection","isselectable"],function(){return!0}),Sf=g(["data","selection","multiple"],!0),Tf=g(["data","onclick"],function(){}),Uf=g(["data","onselected"],function(){}),Vf=g(["data","onunselected"],function(){}),Wf=g(["data","ondragstart"],function(){}),Xf=g(["data","ondragend"],function(){}),Yf=g(["subchart","show"],!1),Zf=Yf?g(["subchart","size","height"],60):0,$f=g(["color","pattern"],null),_f=g(["legend","show"],!0),ag=g(["legend","position"],"bottom"),bg=g(["legend","item","onclick"],function(){}),cg=g(["legend","equally"],!1),dg=g(["axis","rotated"],!1),eg=g(["axis","x","type"],"indexed"),fg=g(["axis","x","categories"],[]),gg=g(["axis","x","tick","centered"],!1),hg=g(["axis","x","tick","format"],null),ig=g(["axis","x","tick","culling"],"categorized"===eg?!1:!0),jg=g(["axis","x","tick","count"],10),kg=g(["axis","x","max"],null),lg=g(["axis","x","min"],null),mg=g(["axis","x","default"],null),ng=g(["axis","x","label"],null),og=g(["axis","y","show"],!0),pg=g(["axis","y","max"],null),qg=g(["axis","y","min"],null),rg=g(["axis","y","center"],null),sg=g(["axis","y","label"],null),tg=g(["axis","y","inner"],!1),ug=g(["axis","y","tick","format"],null),vg=g(["axis","y","padding"],null),wg=g(["axis","y","ticks"],10),xg=g(["axis","y2","show"],!1),yg=g(["axis","y2","max"],null),zg=g(["axis","y2","min"],null),Ag=g(["axis","y2","center"],null),Bg=g(["axis","y2","label"],null),Cg=g(["axis","y2","inner"],!1),Dg=g(["axis","y2","tick","format"],null),Eg=g(["axis","y2","padding"],null),Fg=g(["axis","y2","ticks"],10),Gg=g(["grid","x","show"],!1),Hg=g(["grid","x","type"],"tick"),Ig=g(["grid","x","lines"],null),Jg=g(["grid","y","show"],!1),Kg=g(["grid","y","lines"],null),Lg=g(["grid","y","ticks"],10),Mg=g(["point","show"],!0),Ng=Mg?g(["point","r"],2.5):0,Og=g(["point","focus","line","enabled"],!0),Pg=g(["point","focus","expand","enabled"],!0),Qg=g(["point","focus","expand","r"],Pg?4:Ng),Rg=g(["point","focus","select","r"],8),Sg=g(["pie","label","show"],!0),Tg=g(["pie","label","format"],null),Ug=g(["pie","onclick"],function(){}),Vg=g(["pie","onmouseover"],function(){}),Wg=g(["pie","onmouseout"],function(){}),Xg=g(["donut","label","show"],!0),Yg=g(["donut","label","format"],null),Zg=g(["donut","title"],""),$g=g(["donut","onclick"],function(){}),_g=g(["donut","onmouseover"],function(){}),ah=g(["donut","onmouseout"],function(){}),bh=g(["regions"],[]),ch=g(["tooltip","show"],!0),dh=g(["tooltip","format","title"],null),eh=g(["tooltip","format","value"],null),fh=g(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=dh?dh:b,k=eh?eh:c;for(f=0;f"+(g||0===g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+="",e+=""+i+"",e+=""+h+"",e+="");return e+""}),gh=g(["tooltip","init","show"],!1),hh=g(["tooltip","init","x"],0),ih=g(["tooltip","init","position"],{top:"0px",left:"50px"}),jh=("string"==typeof Ie?Ie.replace("#",""):Ie.id)+"-clip",kh=h(jh),lh="timeseries"===eg,mh="categorized"===eg,nh=!lh&&(Cf||Df),oh=null,ph=!1,qh=!1,rh=Gd(Of,$f),sh=function(){var a=[[Be.time.format("%Y/%-m/%-d"),function(){return!0}],[Be.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Be.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Be.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Be.time.format("%I %p"),function(a){return a.getHours()}],[Be.time.format("%I:%M"),function(a){return a.getMinutes()}],[Be.time.format(":%S"),function(a){return a.getSeconds()}],[Be.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),th=dg?"left":"bottom",uh=dg?tg?"top":"bottom":tg?"right":"left",vh=dg?Cg?"bottom":"top":Cg?"left":"right",wh=dg?"left":"bottom",xh={main:function(){return"translate("+Te.left+","+Te.top+")"},context:function(){return"translate("+Ue.left+","+Ue.top+")"},legend:function(){return"translate("+Ve.left+","+Ve.top+")"},x:function(){return"translate(0,"+(dg?0:Ye)+")"},y:function(){return"translate(0,"+(dg?Ye:0)+")"},y2:function(){return"translate("+(dg?0:We)+","+(dg?1:0)+")"},subx:function(){return"translate(0,"+(dg?0:Ze)+")"},arc:function(){return"translate("+We/2+","+Ye/2+")"}},yh="right"===ag,zh=0,Ah=0,Bh=0,Ch=30,Dh=30,Eh=5;jf=Be.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fh,Gh=function(){var a=Be.svg.line().x(dg?function(a){return T(a.id)(a.value)}:Sc).y(dg?Sc:function(a){return T(a.id)(a.value)});return function(b){var c,d,e=Td(b.values);return wd(b)?(a.interpolate(xd(b)?"cardinal":"linear"),Nf[b.id]?de(e,sf,T(b.id),Nf[b.id]):a(e)):(c=sf(e[0].x),d=T(b.id)(e[0].value),dg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hh=function(){var a;return a=dg?Be.svg.area().x0(function(a){return T(a.id)(0)}).x1(function(a){return T(a.id)(a.value)}).y(Sc):Be.svg.area().x(Sc).y0(function(a){return T(a.id)(0)}).y1(function(a){return T(a.id)(a.value)}),function(b){var c,d,e=Td(b.values);return qd([b],"area")||qd([b],"area-spline")?(a.interpolate(xd(b)?"cardinal":"linear"),a(e)):(c=sf(e[0].x),d=T(b.id)(e[0].value),dg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ih=function(){var a=Be.svg.line().x(dg?function(a){return U(a.id)(a.value)}:Vc).y(dg?Vc:function(a){return U(a.id)(a.value)});return function(b){var c=Td(b.values);return wd(b)?a(c):"M "+vf(c[0].x)+" "+U(b.id)(c[0].value)}}(),Jh=function(){};Fh=Be.svg.brush().on("brush",me),Fh.update=function(){return Nh&&Nh.select("."+He.brush).call(this),this},Fh.scale=function(a){return dg?this.y(a):this.x(a)},Ne&&(Jh=Be.behavior.zoom().on("zoomstart",function(){Jh.altDomain=Be.event.sourceEvent.altKey?sf.orgDomain():null}).on("zoom",Ne?ne:null),Jh.scale=function(a){return dg?this.y(a):this.x(a)},Jh.orgScaleExtent=function(){var a=Oe?Oe:[1,10];return[a[0],Math.max(mc()/a[1],a[1])]},Jh.updateScaleExtent=function(){var a=Wb(sf.orgDomain())/Wb(Rh),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Kh,Lh,Mh,Nh,Oh,Ph,Qh,Rh,Sh,Th={};if(Ce.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Kh.selectAll(Lc(a)),d=c.filter(ye),e=c.filter(ze);Ce.revert(),Ce.defocus(),b(d.classed(He.focused,!0)),b(e),vd(Ce.data.targets)&&Gb(a,!0),ue(a)},Ce.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Kh.selectAll(Lc(a)),d=c.filter(ye),e=c.filter(ze);Ce.revert(),b(d.classed(He.focused,!1)),b(e),vd(Ce.data.targets)&&Hb(a),ve(a)},Ce.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Kh.selectAll(Lc(a)),d=c.filter(ye),e=c.filter(ze);b(d.classed(He.focused,!1)),b(e),vd(Ce.data.targets)&&Hb(a),we()},Ce.show=function(a){Kh.selectAll(Lc(a)).transition().style("opacity",1)},Ce.hide=function(a){Kh.selectAll(Lc(a)).transition().style("opacity",0)},Ce.unzoom=function(){Fh.clear().update(),le({withUpdateXDomain:!0})},Ce.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&ec(a.xs),"categories"in a&&mh&&(fg=a.categories,yf.categories(fg)),"cacheIds"in a&&Xb(a.cacheIds))return void se(Zb(a.cacheIds),a.done);if("data"in a)se(ic(a.data),a.done);else if("url"in a)Be.csv(a.url,function(b,c){se(ic(c),a.done)});else if("rows"in a)se(ic(gc(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");se(ic(hc(a.columns)),a.done)}},Ce.unload=function(a){Ce.data.targets=Ce.data.targets.filter(function(b){return b.id!==a}),Kh.selectAll(Lc(a)).transition().style("opacity",0).remove(),_f&&Oh.selectAll("."+He.legendItem+Kc(a)).remove(),Ce.data.targets.length>0&&le({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ce.selected=function(a){return Be.merge(Mh.selectAll("."+He.shapes+Kc(a)).selectAll("."+He.shape).filter(function(){return Be.select(this).classed(Fe)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ce.select=function(a,b,c){Pf&&Mh.selectAll("."+He.shapes).selectAll("."+He.shape).each(function(e,f){var g=Be.select(this),h="circle"===this.nodeName?Nd:Qd,i="circle"===this.nodeName?Od:Rd,j=Qf||!a||a.indexOf(e.id)>=0,k=!b||b.indexOf(f)>=0,l=g.classed(Fe);j&&k?Rf(e)&&!l&&h(g.classed(Fe,!0),e,f):d(c)&&c&&l&&i(g.classed(Fe,!1),e,f)})},Ce.unselect=function(a,b){Pf&&Mh.selectAll("."+He.shapes).selectAll("."+He.shape).each(function(c,d){var e=Be.select(this),f="circle"===this.nodeName?Od:Rd,g=Qf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0,i=e.classed(Fe);g&&h&&Rf(c)&&i&&f(e.classed(Fe,!1),c,d)})},Ce.toLine=function(a){pd(a,"line"),qe()},Ce.toSpline=function(a){pd(a,"spline"),qe()},Ce.toBar=function(a){pd(a,"bar"),qe()},Ce.toScatter=function(a){pd(a,"scatter"),qe()},Ce.toArea=function(a){pd(a,"area"),qe()},Ce.toAreaSpline=function(a){pd(a,"area-spline"),qe()},Ce.toPie=function(a){pd(a,"pie"),qe({withTransform:!0})},Ce.toDonut=function(a){pd(a,"donut"),qe({withTransform:!0})},Ce.groups=function(a){return c(a)?Hf:(Hf=a,le(),Hf)},Ce.xgrids=function(a){return a?(Ig=a,le(),Ig):Ig},Ce.xgrids.add=function(a){return a?Ce.xgrids(Ig.concat(a)):void 0},Ce.xgrids.remove=function(a){var b=Ae(a);return Ce.xgrids(Ig.filter(b))},Ce.ygrids=function(a){return a?(Kg=a,le(),Kg):Kg},Ce.ygrids.add=function(a){return a?Ce.ygrids(Kg.concat(a)):void 0},Ce.ygrids.remove=function(a){var b=Ae(a);return Ce.ygrids(Kg.filter(b))},Ce.regions=function(a){return c(a)?bh:(bh=a,le(),bh)},Ce.regions.add=function(a){return c(a)?bh:(bh=bh.concat(a),le(),bh)},Ce.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Kh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),bh=bh.filter(function(b){return b.classes.indexOf(a)<0})}),bh},Ce.data.get=function(a){var b=Ce.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ce.data.getAsTarget=function(a){var b=qc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ce.resize=function(a){Je=a?a.width:null,Ke=a?a.height:null,qe({withLegend:!0,withTransition:!1})},Ce.destroy=function(){Ce.data.targets=void 0,Ce.data.x={},Qh.html(""),a.onresize=null},"url"in e.data)Be.csv(e.data.url,function(a,b){ee(b)});else if("rows"in e.data)ee(gc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ee(hc(e.data.columns))}return Ce},"function"==typeof a.define&&a.define.amd?a.define(e):a.c3=e}(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}var e={};e.generate=function(e){function f(a,b){if(!(a in e))throw Error(b)}function g(a,b){for(var c=e,d=0;dWe&&(We=0),0>Ye&&(Ye=0),Ue={top:dg?Te.top:_e-Zf-(yh?0:af),right:0/0,bottom:20+(yh?0:af),left:dg?Ch:Te.left},Xe=dg?Te.left-Ch-Dh:We,Ze=dg?Ye:_e-Ue.top-Ue.bottom,0>Xe&&(Xe=0),0>Ze&&(Ze=0),Ve={top:yh?0:_e-af,right:0/0,bottom:0,left:yh?$e-bf:0},n(),yh&&vd(Ce.data.targets)&&(Ve.left=We/2+df)}function n(){df=Ye/2,cf=.95*df,ef=ud(Ce.data.targets)?.6*cf:0}function o(){var a=dg?He.axisX:He.axisY,b=Be.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Be.select(Ie).node().getBoundingClientRect(),e=c.right-d.left-r();return e>0?e:0}function p(){return Je?Je:v()}function q(){var a=Ke?Ke:w();return a>0?a:320}function r(){return vd(Ce.data.targets)?0:Le?Le:dg||!og||tg?1:t("y")}function s(){var a=1;return vd(Ce.data.targets)?0:Me?Me:yh?bf+(xg&&!dg?t("y2"):a):xg?Cg||dg?a:t("y2"):a}function t(a){var b=db(a);return b.isInner?20+wb(a):40+wb(a)}function u(a){return"y"!==a||og?"y2"!==a||xg?(db(a).isInner?30:40)+("y2"===a?-10:0):Eh:_f&&!yh?10:1}function v(){return+Be.select(Ie).style("width").replace("px","")}function w(){return+Be.select(Ie).style("height").replace("px","")}function x(a){return a?-5:-(Te.left-1)}function y(a){return a?-20:-1}function z(){return x(!dg)}function A(){return y(!dg)}function B(){return x(dg)}function C(){return y(dg)}function D(a){return a?We+2+4:Te.left+20}function E(a){return a?80:Ye+2}function F(){return D(!dg)}function G(){return E(!dg)}function H(){return D(dg)}function I(){return E(dg)}function J(){var a=dg?Ye:We,b=mc(),c=Rb()*(rd(Ce.data.targets)?(b-(mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function K(a){zh=a}function L(a){Ah=a}function M(a){Bh=a}function N(){return _f?yh?Ah*(zh+1):$e:0}function O(){return _f?yh?_e:Bh*(zh+1):0}function P(){var a,b,c=!sf;kf=dg?1:0,lf=dg?Ye:We,mf=dg?0:Ye,nf=dg?We:1,of=kf,pf=lf,qf=dg?0:Ze,rf=dg?Xe:1,sf=R(kf,lf,c?void 0:sf.domain(),function(){return yf.tickOffset()}),tf=S(mf,nf),uf=S(mf,nf),vf=R(kf,lf,Rh,function(a){return a%1?0:Bf.tickOffset()}),wf=S(qf,rf),xf=S(qf,rf),a=Y(),b=Z(),yf=V(sf,th,a,b),Bf=V(vf,wh,a,b),zf=W(tf,uh,ug,wg),Af=W(uf,vh,Dg,Fg),c||(Fh.scale(vf),Ne&&Jh.scale(sf)),Q()}function Q(){ff=zb(),gf=Ab(),hf=Ab(.98)}function R(a,b,e,f){var g=(lh?Be.time.scale():Be.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function S(a,b){return Be.scale.linear().range([a,b])}function T(a){return"y2"===X(a)?uf:tf}function U(a){return"y2"===X(a)?xf:wf}function V(a,b,c,d){var e=(mh?xb():Be.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),mh?e.tickCentered(gg):e.tickOffset=function(){var a=dg?Ye:We;return a*Rb()/mc()/2},mh&&e.categories(fg),e}function W(a,b,c,d){return Be.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function X(a){return a in If?If[a]:"y"}function Y(){var a=lh?sh:mh?vc:null;return hg&&("function"==typeof hg?a=hg:lh&&(a=function(a){return Be.time.format(hg)(a)})),a}function Z(){var a=mc();return ig&&a>jg?jg:a}function $(a){return"string"==typeof a?a:a?a.text:null}function _(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function ab(){return _(ng,dg?"inner-top":"inner-right")}function bb(){return _(sg,dg?"inner-right":"inner-top")}function cb(){return _(Bg,dg?"inner-right":"inner-top")}function db(a){return"y2"===a?cb():"y"===a?bb():ab()}function eb(){return $(ng)}function fb(){return $(sg)}function gb(){return $(Bg)}function hb(a,b){return a?b.isLeft?0:b.isCenter?We/2:We:b.isBottom?-Ye:b.isMiddle?-Ye/2:0}function ib(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function jb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function kb(){return hb(!dg,ab())}function lb(){return hb(dg,bb())}function mb(){return hb(dg,cb())}function nb(){return ib(!dg,ab())}function ob(){return ib(dg,bb())}function pb(){return ib(dg,cb())}function qb(){var a=ab();return dg?a.isInner?"1.2em":-30-wb("x"):a.isInner?"-0.5em":"3em"}function rb(){var a=bb();return dg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-wb("y")}function sb(){var a=cb();return dg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+wb("y2")}function tb(){return jb(!dg,ab())}function ub(){return jb(dg,bb())}function vb(){return jb(dg,cb())}function wb(a){var b=0,c="x"===a?He.axisX:"y"===a?He.axisY:He.axisY2;return Be.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(f=tc(a),b=0;ba?a:0}),c=1;c0||(g[d][b]+=+a)});return Be.min(Object.keys(g).map(function(a){return Be.min(g[a])}))}function Pb(a){var b,c,d,e,f,g=rc(a);if(Hf.length>0)for(f=uc(a),b=0;b0?a:0}),c=1;c+a||(g[d][b]+=+a)});return Be.max(Object.keys(g).map(function(a){return Be.max(g[a])}))}function Qb(a){var c,d,e,f,g,h,i,j,k=qc(function(b){return X(b.id)===a}),l="y2"===a?zg:qg,m="y2"===a?yg:pg,n=b(l)?l:Ob(k),o=b(m)?m:Pb(k),p="y2"===a?Ag:rg,q=Qc()&&dg;return n===o&&(0>n?o=0:n=0),c=Math.abs(o-n),d=e=f=q?0:.1*c,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&vg&&(e=b(vg.top)?vg.top:d,f=b(vg.bottom)?vg.bottom:d),"y2"===a&&Eg&&(e=b(Eg.top)?Eg.top:d,f=b(Eg.bottom)?Eg.bottom:d),q&&(h=Rc(n,o),i=Wb(tf.range()),j=[h[0]/i,h[1]/i],e+=c*(j[1]/(1-j[0]-j[1])),f+=c*(j[0]/(1-j[0]-j[1]))),rd(k)&&!tc(k)&&(f=n),[n-f,o+e]}function Rb(a){var b=Wb(Rh),c=Wb(sf.domain());return a||0===c?1:b/c}function Sb(a){return lg?lg:Be.min(a,function(a){return Be.min(a.values,function(a){return a.x})})}function Tb(a){return kg?kg:Be.max(a,function(a){return Be.max(a.values,function(a){return a.x})})}function Ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mh?d=0:rd(a)?(c=mc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Vb(a){var b=[Sb(a),Tb(a)],c=b[0],d=b[1],e=Ub(a,b),f=lh?new Date(c.getTime()-e):c-e,g=lh?new Date(d.getTime()+e):d+e;return[f,g]}function Wb(a){return a[1]-a[0]}function Xb(a){for(var b=0;bd?0:d}function ac(a){return Cf&&a===Cf||Df&&Ld(Df,a)}function bc(a){return!ac(a)}function cc(a){return Cf?Cf:Df?Df[a]:null}function dc(a,b){return a in Ce.data.x&&Ce.data.x[a]&&Ce.data.x[a][b]?Ce.data.x[a][b]:b}function ec(a){Object.keys(a).forEach(function(b){Df[b]=a[b]})}function fc(a){var b;return a&&(b=Gf[a.id],a.name=b?b:a.id),a}function gc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?a.map(function(a){return a[c]}):Ce.data.x[Object.keys(Ce.data.x)[0]]}),b=c.map(function(b,c){var d=Ff(b);return{id:d,id_org:b,values:a.map(function(a,e){var f,g=cc(b);return lh?f=a[g]instanceof Date?a[g]:Hd(a[g]):nh&&!mh?f=a[g]?+a[g]:dc(b,e):nh&&mh?(f=e,0===c&&a[g]&&(0===e&&(fg=[]),fg.push(a[g]))):f=e,a.x=f,{x:f,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}})}}),b.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++})}),Jf&&pd(oc(b).filter(function(a){return!(a in Kf)}),Jf),b.forEach(function(a){Yb(a.id_org,a)}),b}function jc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function kc(a){return a>0&&Ce.data.targets[0].values[a-1]?Ce.data.targets[0].values[a-1].x:void 0}function lc(a){return a1?Ce.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ce.data.targets[0]:null,a}function oc(a){return a=c(a)?Ce.data.targets:a,a.map(function(a){return a.id})}function pc(a){var b,c=oc();for(b=0;ba})}function uc(a){return sc(a,function(a){return a>0})}function vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(Yc(a,f))),a[g].x&&(e=e.concat(Yc(a,g))),_c(e,b)):Zc(a,b,f,g)}function $c(a,b){var c;return c=a.map(function(a){return Zc(a.values,b)}),_c(c,b)}function _c(a,b){var c,d;return a.forEach(function(a){var e=Md(a,b);(c>e||!c)&&(c=e,d=a)}),d}function ad(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 bd(){return Mf&&"desc"===Mf.toLowerCase()}function cd(){return Mf&&"asc"===Mf.toLowerCase()}function dd(a){var b=cd(),c=bd();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 Mf&&a.sort(Mf),a}function ed(a,c){var d,e,f,g,h,i,j,k=vd(Ce.data.targets),l=k?Xc:Wc,m=a.filter(function(a){return a&&b(a.value)});ch&&0!==m.length&&(Ph.html(fh(a,Y(),l,rh)).style("display","block"),d=Ph.property("offsetWidth"),e=Ph.property("offsetHeight"),k?(g=We/2+c[0],i=Ye/2+c[1]+20):(dg?(f=o(),g=f+c[0]+100,h=g+d,j=p()-s(),i=sf(m[0].x)+20):(f=o(),g=f+r()+sf(m[0].x)+20,h=g+d,j=f+p()-s(),i=c[1]+15),h>j&&(g-=d+60),i+e>q()&&(i-=e+30)),Ph.style("top",i+"px").style("left",g+"px"))}function fd(){Ph.style("display","none")}function gd(a){var c=a.filter(function(a){return a&&b(a.value)});ch&&(sd(Ce.data.targets)||vd(Ce.data.targets)||Mh.selectAll("line."+He.xgridFocus).style("visibility","visible").data([c[0]]).attr(dg?"y1":"x1",Sc).attr(dg?"y2":"x2",Sc))}function hd(){Mh.select("line."+He.xgridFocus).style("visibility","hidden")}function id(a){return a.x||0===a.x?sf(a.x):null}function jd(a){return T(a.id)(a.value)}function kd(){var a,b,d={},e=0;return qc(yd).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function od(a,b){return b?2*a.tickOffset()*.6/b:0}function pd(a,b){var d=c(a)?oc():a;"string"==typeof d&&(d=[d]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function de(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function ee(b){var c,d,e;if(Qh=Be.select(Ie),Qh.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qh.html(""),Qh.classed("c3",!0),Ce.data.x={},Ce.data.targets=ic(b),m(),P(),sf.domain(Be.extent(Vb(Ce.data.targets))),tf.domain(Qb("y")),uf.domain(Qb("y2")),vf.domain(sf.domain()),wf.domain(tf.domain()),xf.domain(uf.domain()),Rh=sf.domain(),Fh.scale(vf),Ne&&Jh.scale(sf),Kh=Qh.append("svg").attr("width",We+Te.left+Te.right).attr("height",Ye+Te.top+Te.bottom).on("mouseenter",Qe).on("mouseleave",Re),Lh=Kh.append("defs"),Lh.append("clipPath").attr("id",jh).append("rect").attr("width",We).attr("height",Ye),Lh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",z).attr("y",A).attr("width",F).attr("height",G),Lh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Mh=Kh.append("g").attr("transform",xh.main),Nh=Yf?Kh.append("g").attr("transform",xh.context):null,Oh=_f?Kh.append("g").attr("transform",xh.legend):null,Ph=Be.select(Ie).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Mh.append("g").attr("class",He.axisX).attr("clip-path",dg?"":h("xaxis-clip")).attr("transform",xh.x).append("text").attr("class",He.axisXLabel).attr("transform",dg?"rotate(-90)":"").attr("dx",nb).attr("dy",qb).style("text-anchor",tb).text(eb),og&&Mh.append("g").attr("class",He.axisY).attr("clip-path",dg?h("yaxis-clip"):"").append("text").attr("class",He.axisYLabel).attr("transform",dg?"":"rotate(-90)").attr("dx",ob).attr("dy",rb).style("text-anchor",ub).text(fb),xg&&Mh.append("g").attr("class",He.axisY2).attr("transform",xh.y2).append("text").attr("class",He.axisY2Label).attr("transform",dg?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(gb),d=Mh.append("g").attr("clip-path",kh).attr("class",He.grid),Gg&&d.append("g").attr("class",He.xgrids),Ig&&d.append("g").attr("class",He.xgridLines),Og&&d.append("g").attr("class",He.xgridFocus).append("line").attr("class",He.xgridFocus).attr("x1",dg?0:-10).attr("x2",dg?We:-10).attr("y1",dg?-10:Te.top).attr("y2",dg?-10:Ye),Jg&&d.append("g").attr("class",He.ygrids),Kg&&d.append("g").attr("class",He.ygridLines),Mh.append("g").attr("clip-path",kh).attr("class",He.regions),Mh.append("g").attr("clip-path",kh).attr("class",He.chart),c=Mh.select("."+He.chart).append("g").attr("class",He.eventRects).style("fill-opacity",0).style("cursor",Ne?dg?"ns-resize":"ew-resize":null),Mh.select("."+He.chart).append("g").attr("class",He.chartBars),Mh.select("."+He.chart).append("g").attr("class",He.chartLines),Mh.select("."+He.chart).append("g").attr("class",He.chartArcs).attr("transform",xh.arc).append("text").attr("class",He.chartArcsTitle).style("text-anchor","middle").text(Kb()),Mh.select("."+He.chart).append("g").attr("class",He.chartTexts),Ne&&Mh.insert("rect",Pe?null:"g.grid").attr("class",He.zoomRect).attr("width",We).attr("height",Ye).style("opacity",0).style("cursor",dg?"ns-resize":"ew-resize").call(Jh).on("dblclick.zoom",null),null!==mg&&Fh.extent("function"!=typeof mg?mg:mg(Vb())),Yf&&(Nh.append("g").attr("clip-path",kh).attr("class",He.chart),Nh.select("."+He.chart).append("g").attr("class",He.chartBars),Nh.select("."+He.chart).append("g").attr("class",He.chartLines),Nh.append("g").attr("clip-path",kh).attr("class",He.brush).call(Fh).selectAll("rect").attr(dg?"width":"height",dg?Xe:Ze),Nh.append("g").attr("class",He.axisX).attr("transform",xh.subx).attr("clip-path",dg?"":h("xaxis-clip"))),re(Ce.data.targets),dg?Mh.select("."+He.axisX).style("opacity",0).call(yf):(Mh.select("."+He.axisY).style("opacity",0).call(zf),Mh.select("."+He.axisY2).style("opacity",0).call(Af)),qe({withTransform:!0,withLegend:!0,durationForAxis:0}),gh){if(lh&&"string"==typeof hh){for(hh=Hd(hh),e=0;e0){d=[];for(var f in Gf)for(c=0;cf&&g>c&&d>h&&i>d):"path"===this.nodeName&&(l=ad(this),c=l.x,d=l.y,e=l.width,j=l.height,k=Sd,p=!(c>g||f>c+e||d>i||h>d+j)),p^o&&(m.classed(Ge,!o),m.classed(Fe,!n),k(!n,m,a,b))}))}function je(a){vd(Ce.data.targets)||Pf&&(oh=a,Mh.select("."+He.chart).append("rect").attr("class",He.dragarea).style("opacity",.1),ph=!0,Wf())}function ke(){vd(Ce.data.targets)||Pf&&(Mh.select("."+He.dragarea).transition().duration(100).style("opacity",0).remove(),Mh.selectAll("."+He.shape).classed(Ge,!1),ph=!1,Xf())}function le(a){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=kd(),I=vd(Ce.data.targets); +if(a=d(a)?a:{},t=d(a.withY)?a.withY:!0,u=d(a.withSubchart)?a.withSubchart:!0,v=d(a.withTransition)?a.withTransition:!0,w=d(a.withTransform)?a.withTransform:!1,x=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,y=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,z=d(a.withLegend)?a.withLegend:!1,E=v?Se:0,F=d(a.durationForExit)?a.durationForExit:E,G=d(a.durationForAxis)?a.durationForAxis:E,z&&_f&&xe(Ce.data.targets,a),y&&(sf.domain(Be.extent(Vb(Ce.data.targets))),Rh=sf.domain(),Ne&&Jh.scale(sf).updateScaleExtent(),vf.domain(sf.domain()),Fh.scale(vf)),x&&(sf.domain(Fh.empty()?Rh:Fh.extent()),Ne&&Jh.scale(sf).updateScaleExtent()),tf.domain(Qb("y")),uf.domain(Qb("y2")),Mh.select("."+He.axisX).style("opacity",I?0:1).transition().duration(G).call(yf),Mh.select("."+He.axisY).style("opacity",I?0:1).transition().duration(G).call(zf),Mh.select("."+He.axisY2).style("opacity",I?0:1).transition().duration(G).call(Af),A=$d(H),C=_d(H,!0),D=_d(H,!1),Mh.select("."+He.axisX+" ."+He.axisXLabel).attr("x",kb),Mh.select("."+He.axisY+" ."+He.axisYLabel).attr("x",lb).attr("dy",rb),Mh.select("."+He.axisY2+" ."+He.axisY2Label).attr("x",mb).attr("dy",sb),wf.domain(tf.domain()),xf.domain(uf.domain()),Ph.style("display","none"),Mh.select("line."+He.xgridFocus).style("visibility","hidden").attr("y2",Ye),Gg){if("year"===Hg){e=[];for(var K=Vb(),L=K[0].getFullYear(),M=K[1].getFullYear(),N=L;M>=N;N++)e.push(new Date(N+"-01-01 00:00:00"))}else e=sf.ticks(10);c=Mh.select("."+He.xgrids).selectAll("."+He.xgrid).data(e),c.enter().append("line").attr("class",He.xgrid),c.attr("x1",dg?0:function(a){return sf(a)-yf.tickOffset()}).attr("x2",dg?We:function(a){return sf(a)-yf.tickOffset()}).attr("y1",dg?function(a){return sf(a)-yf.tickOffset()}:Te.top).attr("y2",dg?function(a){return sf(a)-yf.tickOffset()}:Ye).style("opacity",function(){return+Be.select(this).attr(dg?"y1":"x1")===(dg?Ye:0)?0:1}),c.exit().remove()}Ig&&(f=Mh.select("."+He.xgridLines).selectAll("."+He.xgridLine).data(Ig),g=f.enter().append("g").attr("class",function(a){return He.xgridLine+(a.class?a.class:"")}),g.append("line").style("opacity",0),g.append("text").attr("text-anchor","end").attr("transform",dg?"":"rotate(-90)").attr("dx",dg?0:-Te.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(E).attr("x1",dg?0:Tc).attr("x2",dg?We:Tc).attr("y1",dg?Tc:Te.top).attr("y2",dg?Tc:Ye).style("opacity",1),f.select("text").transition().duration(E).attr("x",dg?We:0).attr("y",Tc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(E).style("opacity",0).remove()),t&&Jg&&(h=Mh.select("."+He.ygrids).selectAll("."+He.ygrid).data(tf.ticks(Lg)),h.enter().append("line").attr("class",He.ygrid),h.attr("x1",dg?tf:0).attr("x2",dg?tf:We).attr("y1",dg?0:tf).attr("y2",dg?Ye:tf),h.exit().remove()),t&&Kg&&(i=Mh.select("."+He.ygridLines).selectAll("."+He.ygridLine).data(Kg),j=i.enter().append("g").attr("class",function(a){return He.ygridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",dg?"rotate(-90)":"").attr("dx",dg?0:-Te.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(E).attr("x1",dg?Uc:0).attr("x2",dg?Uc:We).attr("y1",dg?0:Uc).attr("y2",dg?Ye:Uc).style("opacity",1),i.select("text").transition().duration(E).attr("x",dg?0:We).attr("y",Uc).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(E).style("opacity",0).remove()),l=Mh.selectAll("."+He.bars).selectAll("."+He.bar).data(Dd),l.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return rh(a.id)}).attr("class",Ec),l.style("opacity",Mc).transition().duration(E).attr("d",A).style("opacity",1),l.exit().transition().duration(F).style("opacity",0).remove(),n=Mh.selectAll("."+He.texts).selectAll("."+He.text).data(Fd),n.enter().append("text").attr("class",xc).attr("text-anchor",function(a){return dg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Wc(a.value)}),n.style("fill-opacity",Nc).transition().duration(E).attr("x",C).attr("y",D).style("fill-opacity",Pc),n.exit().transition().duration(F).style("fill-opacity",0).remove(),Mh.selectAll("."+He.line).style("opacity",Mc).transition().duration(E).attr("d",Gh).style("opacity",1),Mh.selectAll("."+He.area).style("opacity",0).transition().duration(E).attr("d",Hh).style("opacity",Sh),k=Mh.selectAll("."+He.circles).selectAll("."+He.circle).data(Ed),k.enter().append("circle").attr("class",Cc).style("opacity",0).attr("r",Ng),k.style("opacity",Mc).transition().duration(E).style("opacity",Oc).attr("cx",dg?jd:id).attr("cy",dg?id:jd),k.exit().remove(),Mh.selectAll("."+He.chartArc).select("."+He.arc).attr("transform",w?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(E).attrTween("d",function(a){var b=yb(a);if(!b)return function(){return"M 0 0"};var c=Be.interpolate(this._current,b);return this._current=c(0),function(a){return Bb(c(a),!0)}}).attr("transform",w?"scale(1)":"").style("opacity",1),Mh.selectAll("."+He.chartArc).select("text").attr("transform",Cb).style("opacity",0).transition().duration(E).text(Fb).style("opacity",function(a){return Cd(a.data)?1:0}),Mh.select("."+He.chartArcsTitle).style("opacity",ud(Ce.data.targets)?1:0),Yf&&(null!==Be.event&&"zoom"===Be.event.type&&Fh.extent(sf.orgDomain()).update(),u&&(Nh.select("."+He.axisX).style("opacity",I?0:1).transition().duration(E).call(Bf),Fh.empty()||Fh.extent(sf.orgDomain()).update(),B=$d(H,!0),o=Nh.selectAll("."+He.bars).selectAll("."+He.bar).data(Dd),o.enter().append("path").attr("d",B).style("stroke","none").style("fill",function(a){return rh(a.id)}).attr("class",Ec),o.style("opacity",Mc).transition().duration(E).attr("d",B).style("opacity",1),o.exit().transition().duration(E).style("opacity",0).remove(),Nh.selectAll("."+He.line).style("opacity",Mc).transition().duration(E).attr("d",Ih).style("opacity",1))),Mh.selectAll("."+He.selectedCircles).filter(function(a){return yd(a)}).selectAll("circle").remove(),Mh.selectAll("."+He.selectedCircle).transition().duration(E).attr("cx",dg?jd:id).attr("cy",dg?id:jd),Df?(p=Mh.select("."+He.eventRects).selectAll("."+He.eventRect).data([0]),ge(p.enter()),p.attr("x",0).attr("y",0).attr("width",We).attr("height",Ye)):(nh&&!mh?(s=function(a,b){var c=kc(b),d=lc(b);return(sf(d?d:a.x+50)-sf(c?c:a.x-50))/2},r=function(a,b){var c=kc(b);return(sf(a.x)+sf(c?c:a.x-50))/2}):(s=J(),r=function(a){return sf(a.x)-s/2}),q=nc(),Mh.select("."+He.eventRects).datum(q?q.values:[]),p=Mh.select("."+He.eventRects).selectAll("."+He.eventRect).data(function(a){return a}),fe(p.enter()),p.attr("class",Jc).attr("x",dg?0:r).attr("y",dg?r:0).attr("width",dg?We:s).attr("height",dg?s:Ye),p.exit().remove()),m=Mh.select("."+He.regions).selectAll("rect."+He.region).data(bh),m.enter().append("rect").style("fill-opacity",0),m.attr("class",Ic).attr("x",dg?0:$b).attr("y",dg?$b:Te.top).attr("width",dg?We:_b).attr("height",dg?_b:Ye).transition().duration(E).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),m.exit().transition().duration(E).style("fill-opacity",0).remove(),oc().forEach(function(a){Th[a]=!0})}function me(){le({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function ne(){return"mousemove"===Be.event.sourceEvent.type&&Jh.altDomain?(sf.domain(Jh.altDomain),void Jh.scale(sf).updateScaleExtent()):(mh&&sf.orgDomain()[0]===Rh[0]&&sf.domain([Rh[0]-1e-10,sf.orgDomain()[1]]),le({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Be.event.sourceEvent.type&&(qh=!0)))}function oe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pe(){Kh.attr("width",$e).attr("height",_e),Kh.select("#"+jh).select("rect").attr("width",We).attr("height",Ye),Kh.select("#xaxis-clip").select("rect").attr("width",F),Kh.select("#yaxis-clip").select("rect").attr("width",H),Kh.select("."+He.zoomRect).attr("width",We).attr("height",Ye)}function qe(a){a=d(a)?a:{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.durationForExit=0,m(),P(),pe(),l(a.withTransition),le(a)}function re(a){var b,c,d,e,f,g,h,i,j,k,l,m;h=Mh.select("."+He.chartTexts).selectAll("."+He.chartText).data(a),i=h.enter().append("g").attr("class",function(a){return He.chartText+wc(He.target,a.id)}).style("pointer-events","none"),i.append("g").attr("class",yc).style("fill",function(a){return rh(a.id)}),e=Mh.select("."+He.chartBars).selectAll("."+He.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return He.chartBar+wc(He.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Fc).style("fill",function(a){return rh(a.id)}).style("stroke","none").style("cursor",function(a){return Rf(a)?"pointer":null}),c=Mh.select("."+He.chartLines).selectAll("."+He.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return He.chartLine+wc(He.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Bc).style("opacity",0).style("stroke",function(a){return rh(a.id)}),b.append("path").attr("class",Hc).style("opacity",function(){return Sh=+Be.select(this).style("opacity"),0}).style("fill",function(a){return rh(a.id)}),b.append("g").attr("class",function(a){return wc(He.selectedCircles,a.id)}),b.append("g").attr("class",Dc).style("fill",function(a){return rh(a.id)}).style("cursor",function(a){return Rf(a)?"pointer":null}),a.forEach(function(a){Mh.selectAll("."+He.selectedCircles+Kc(a.id)).selectAll("."+He.selectedCircle).each(function(b){b.value=a.values[b.x].value})}),g=Mh.select("."+He.chartArcs).selectAll("."+He.chartArc).data(jf(a)),f=g.enter().append("g").attr("class",function(a){return He.chartArc+wc(He.target,a.data.id)}),f.append("path").attr("class",Gc).style("opacity",0).style("fill",function(a){return rh(a.data.id)}).style("cursor",function(a){return Rf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Eb(a),d=Mb();Gb(a.data.id),ue(a.data.id),d(c,b)}).on("mousemove",function(a){var b=[Eb(a)];ed(b,Be.mouse(this))}).on("mouseout",function(a,b){var c=Eb(a),d=Nb();Hb(a.data.id),we(),fd(),d(c,b)}).on("click",function(a,b){var c=Eb(a),d=Lb();d(c,b)}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Yf&&(m=Nh.select("."+He.chartBars).selectAll("."+He.chartBar).data(a),l=m.enter().append("g").attr("class",function(a){return He.chartBar+wc(He.target,a.id)}),l.append("g").attr("class",Fc).style("fill",function(a){return rh(a.id)}),k=Nh.select("."+He.chartLines).selectAll("."+He.chartLine).data(a),j=k.enter().append("g").attr("class",function(a){return He.chartLine+wc(He.target,a.id)}),j.append("path").attr("class",Bc).style("opacity",0).style("stroke",function(a){return rh(a.id)})),Kh.selectAll("."+He.target).transition().style("opacity",1)}function se(a,b){Ce.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+r)/10),i=10*Math.ceil((g.height+q)/10),j=yh?i:h,k=yh?af:bf;c&&(v=0,B=0,s=0,t=0),x[b]=h,y[b]=i,(!s||h>=s)&&(s=h),(!t||i>=t)&&(t=i),f=yh?t:s,cg?(Object.keys(x).forEach(function(a){x[a]=s}),Object.keys(y).forEach(function(a){y[a]=t}),e=(k-f*p.length)/2,u>e?(v=0,B=0,p.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,n,o,p=oc(a),q=4,r=26,s=0,t=0,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=c(b)?{}:b,o=d(b.withTransition)?b.withTransition:!0,yh?(g=function(a){return s*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return t*(.2+A[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},n=function(a,b){return j(a,b)-7},f=Oh.selectAll("."+He.legendItem).data(p).enter().append("g").attr("class",function(a){return wc(He.legendItem,a)}).style("cursor","pointer").on("click",function(a){bg(a)}).on("mouseover",function(a){Ce.focus(a)}).on("mouseout",function(){Ce.revert()}),f.append("text").text(function(a){return d(Gf[a])?Gf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",yh?h:-200).attr("y",yh?-200:k),f.append("rect").attr("class",He.legendItemEvent).style("fill-opacity",0).attr("x",yh?i:-200).attr("y",yh?-200:n).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class",He.legendItemTile).style("pointer-events","none").style("fill",function(a){return rh(a)}).attr("x",yh?h:-200).attr("y",yh?-200:j).attr("width",10).attr("height",10),Oh.selectAll("text").data(p).each(function(a,b){e(this,a,0===b)}).transition().duration(o?250:0).attr("x",h).attr("y",k),Oh.selectAll("rect."+He.legendItemEvent).data(p).transition().duration(o?250:0).attr("x",i).attr("y",n),Oh.selectAll("rect."+He.legendItemTile).data(p).transition().duration(o?250:0).attr("x",g).attr("y",j),L(s),M(t),K(B),m(),P(),pe(),l(!1)}function ye(a){return pc(a.id)}function ze(a){return"data"in a&&pc(a.data.id)}function Ae(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}}var Be=a.d3?a.d3:a.require?a.require("d3"):void 0,Ce={data:{}},De={},Ee="_expanded_",Fe="_selected_",Ge="_included_",He={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",dragarea:"c3-dragarea"},Ie=g(["bindto"],"#chart"),Je=g(["size","width"],null),Ke=g(["size","height"],null),Le=g(["padding","left"],null),Me=g(["padding","right"],null),Ne=g(["zoom","enabled"],!1),Oe=g(["zoom","extent"],null),Pe=g(["zoom","privileged"],!1),Qe=g(["onenter"],function(){}),Re=g(["onleave"],function(){}),Se=g(["transition","duration"],350);f("data","data is required in config");var Te,Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf=g(["data","x"],null),Df=g(["data","xs"],null),Ef=g(["data","x_format"],"%Y-%m-%d"),Ff=g(["data","id_converter"],function(a){return a}),Gf=g(["data","names"],{}),Hf=g(["data","groups"],[]),If=g(["data","axes"],{}),Jf=g(["data","type"],null),Kf=g(["data","types"],{}),Lf=g(["data","labels"],{}),Mf=g(["data","order"],null),Nf=g(["data","regions"],{}),Of=g(["data","colors"],{}),Pf=g(["data","selection","enabled"],!1),Qf=g(["data","selection","grouped"],!1),Rf=g(["data","selection","isselectable"],function(){return!0}),Sf=g(["data","selection","multiple"],!0),Tf=g(["data","onclick"],function(){}),Uf=g(["data","onselected"],function(){}),Vf=g(["data","onunselected"],function(){}),Wf=g(["data","ondragstart"],function(){}),Xf=g(["data","ondragend"],function(){}),Yf=g(["subchart","show"],!1),Zf=Yf?g(["subchart","size","height"],60):0,$f=g(["color","pattern"],null),_f=g(["legend","show"],!0),ag=g(["legend","position"],"bottom"),bg=g(["legend","item","onclick"],function(){}),cg=g(["legend","equally"],!1),dg=g(["axis","rotated"],!1),eg=g(["axis","x","type"],"indexed"),fg=g(["axis","x","categories"],[]),gg=g(["axis","x","tick","centered"],!1),hg=g(["axis","x","tick","format"],null),ig=g(["axis","x","tick","culling"],"categorized"===eg?!1:!0),jg=g(["axis","x","tick","count"],10),kg=g(["axis","x","max"],null),lg=g(["axis","x","min"],null),mg=g(["axis","x","default"],null),ng=g(["axis","x","label"],null),og=g(["axis","y","show"],!0),pg=g(["axis","y","max"],null),qg=g(["axis","y","min"],null),rg=g(["axis","y","center"],null),sg=g(["axis","y","label"],null),tg=g(["axis","y","inner"],!1),ug=g(["axis","y","tick","format"],null),vg=g(["axis","y","padding"],null),wg=g(["axis","y","ticks"],10),xg=g(["axis","y2","show"],!1),yg=g(["axis","y2","max"],null),zg=g(["axis","y2","min"],null),Ag=g(["axis","y2","center"],null),Bg=g(["axis","y2","label"],null),Cg=g(["axis","y2","inner"],!1),Dg=g(["axis","y2","tick","format"],null),Eg=g(["axis","y2","padding"],null),Fg=g(["axis","y2","ticks"],10),Gg=g(["grid","x","show"],!1),Hg=g(["grid","x","type"],"tick"),Ig=g(["grid","x","lines"],null),Jg=g(["grid","y","show"],!1),Kg=g(["grid","y","lines"],null),Lg=g(["grid","y","ticks"],10),Mg=g(["point","show"],!0),Ng=Mg?g(["point","r"],2.5):0,Og=g(["point","focus","line","enabled"],!0),Pg=g(["point","focus","expand","enabled"],!0),Qg=g(["point","focus","expand","r"],Pg?4:Ng),Rg=g(["point","focus","select","r"],8),Sg=g(["pie","label","show"],!0),Tg=g(["pie","label","format"],null),Ug=g(["pie","onclick"],function(){}),Vg=g(["pie","onmouseover"],function(){}),Wg=g(["pie","onmouseout"],function(){}),Xg=g(["donut","label","show"],!0),Yg=g(["donut","label","format"],null),Zg=g(["donut","title"],""),$g=g(["donut","onclick"],function(){}),_g=g(["donut","onmouseover"],function(){}),ah=g(["donut","onmouseout"],function(){}),bh=g(["regions"],[]),ch=g(["tooltip","show"],!0),dh=g(["tooltip","format","title"],null),eh=g(["tooltip","format","value"],null),fh=g(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=dh?dh:b,k=eh?eh:c;for(f=0;f"+(g||0===g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+="",e+=""+i+"",e+=""+h+"",e+="");return e+""}),gh=g(["tooltip","init","show"],!1),hh=g(["tooltip","init","x"],0),ih=g(["tooltip","init","position"],{top:"0px",left:"50px"}),jh=("string"==typeof Ie?Ie.replace("#",""):Ie.id)+"-clip",kh=h(jh),lh="timeseries"===eg,mh="categorized"===eg,nh=!lh&&(Cf||Df),oh=null,ph=!1,qh=!1,rh=Gd(Of,$f),sh=function(){var a=[[Be.time.format("%Y/%-m/%-d"),function(){return!0}],[Be.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Be.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Be.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Be.time.format("%I %p"),function(a){return a.getHours()}],[Be.time.format("%I:%M"),function(a){return a.getMinutes()}],[Be.time.format(":%S"),function(a){return a.getSeconds()}],[Be.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),th=dg?"left":"bottom",uh=dg?tg?"top":"bottom":tg?"right":"left",vh=dg?Cg?"bottom":"top":Cg?"left":"right",wh=dg?"left":"bottom",xh={main:function(){return"translate("+Te.left+","+Te.top+")"},context:function(){return"translate("+Ue.left+","+Ue.top+")"},legend:function(){return"translate("+Ve.left+","+Ve.top+")"},x:function(){return"translate(0,"+(dg?0:Ye)+")"},y:function(){return"translate(0,"+(dg?Ye:0)+")"},y2:function(){return"translate("+(dg?0:We)+","+(dg?1:0)+")"},subx:function(){return"translate(0,"+(dg?0:Ze)+")"},arc:function(){return"translate("+We/2+","+Ye/2+")"}},yh="right"===ag,zh=0,Ah=0,Bh=0,Ch=30,Dh=30,Eh=5;jf=Be.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fh,Gh=function(){var a=Be.svg.line().x(dg?function(a){return T(a.id)(a.value)}:Sc).y(dg?Sc:function(a){return T(a.id)(a.value)});return function(b){var c,d,e=Td(b.values);return wd(b)?(a.interpolate(xd(b)?"cardinal":"linear"),Nf[b.id]?de(e,sf,T(b.id),Nf[b.id]):a(e)):(c=sf(e[0].x),d=T(b.id)(e[0].value),dg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hh=function(){var a;return a=dg?Be.svg.area().x0(function(a){return T(a.id)(0)}).x1(function(a){return T(a.id)(a.value)}).y(Sc):Be.svg.area().x(Sc).y0(function(a){return T(a.id)(0)}).y1(function(a){return T(a.id)(a.value)}),function(b){var c,d,e=Td(b.values);return qd([b],"area")||qd([b],"area-spline")?(a.interpolate(xd(b)?"cardinal":"linear"),a(e)):(c=sf(e[0].x),d=T(b.id)(e[0].value),dg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ih=function(){var a=Be.svg.line().x(dg?function(a){return U(a.id)(a.value)}:Vc).y(dg?Vc:function(a){return U(a.id)(a.value)});return function(b){var c=Td(b.values);return wd(b)?a(c):"M "+vf(c[0].x)+" "+U(b.id)(c[0].value)}}(),Jh=function(){};Fh=Be.svg.brush().on("brush",me),Fh.update=function(){return Nh&&Nh.select("."+He.brush).call(this),this},Fh.scale=function(a){return dg?this.y(a):this.x(a)},Ne&&(Jh=Be.behavior.zoom().on("zoomstart",function(){Jh.altDomain=Be.event.sourceEvent.altKey?sf.orgDomain():null}).on("zoom",Ne?ne:null),Jh.scale=function(a){return dg?this.y(a):this.x(a)},Jh.orgScaleExtent=function(){var a=Oe?Oe:[1,10];return[a[0],Math.max(mc()/a[1],a[1])]},Jh.updateScaleExtent=function(){var a=Wb(sf.orgDomain())/Wb(Rh),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Kh,Lh,Mh,Nh,Oh,Ph,Qh,Rh,Sh,Th={};if(Ce.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Kh.selectAll(Lc(a)),d=c.filter(ye),e=c.filter(ze);Ce.revert(),Ce.defocus(),b(d.classed(He.focused,!0)),b(e),vd(Ce.data.targets)&&Gb(a,!0),ue(a)},Ce.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=Kh.selectAll(Lc(a)),d=c.filter(ye),e=c.filter(ze);Ce.revert(),b(d.classed(He.focused,!1)),b(e),vd(Ce.data.targets)&&Hb(a),ve(a)},Ce.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=Kh.selectAll(Lc(a)),d=c.filter(ye),e=c.filter(ze);b(d.classed(He.focused,!1)),b(e),vd(Ce.data.targets)&&Hb(a),we()},Ce.show=function(a){Kh.selectAll(Lc(a)).transition().style("opacity",1)},Ce.hide=function(a){Kh.selectAll(Lc(a)).transition().style("opacity",0)},Ce.unzoom=function(){Fh.clear().update(),le({withUpdateXDomain:!0})},Ce.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&ec(a.xs),"categories"in a&&mh&&(fg=a.categories,yf.categories(fg)),"cacheIds"in a&&Xb(a.cacheIds))return void se(Zb(a.cacheIds),a.done);if("data"in a)se(ic(a.data),a.done);else if("url"in a)Be.csv(a.url,function(b,c){se(ic(c),a.done)});else if("rows"in a)se(ic(gc(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");se(ic(hc(a.columns)),a.done)}},Ce.unload=function(a){Ce.data.targets=Ce.data.targets.filter(function(b){return b.id!==a}),Kh.selectAll(Lc(a)).transition().style("opacity",0).remove(),_f&&Oh.selectAll("."+He.legendItem+Kc(a)).remove(),Ce.data.targets.length>0&&le({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ce.selected=function(a){return Be.merge(Mh.selectAll("."+He.shapes+Kc(a)).selectAll("."+He.shape).filter(function(){return Be.select(this).classed(Fe)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ce.select=function(a,b,c){Pf&&Mh.selectAll("."+He.shapes).selectAll("."+He.shape).each(function(e,f){var g=Be.select(this),h="circle"===this.nodeName?Nd:Qd,i="circle"===this.nodeName?Od:Rd,j=Qf||!a||a.indexOf(e.id)>=0,k=!b||b.indexOf(f)>=0,l=g.classed(Fe);j&&k?Rf(e)&&!l&&h(g.classed(Fe,!0),e,f):d(c)&&c&&l&&i(g.classed(Fe,!1),e,f)})},Ce.unselect=function(a,b){Pf&&Mh.selectAll("."+He.shapes).selectAll("."+He.shape).each(function(c,d){var e=Be.select(this),f="circle"===this.nodeName?Od:Rd,g=Qf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0,i=e.classed(Fe);g&&h&&Rf(c)&&i&&f(e.classed(Fe,!1),c,d)})},Ce.toLine=function(a){pd(a,"line"),qe()},Ce.toSpline=function(a){pd(a,"spline"),qe()},Ce.toBar=function(a){pd(a,"bar"),qe()},Ce.toScatter=function(a){pd(a,"scatter"),qe()},Ce.toArea=function(a){pd(a,"area"),qe()},Ce.toAreaSpline=function(a){pd(a,"area-spline"),qe()},Ce.toPie=function(a){pd(a,"pie"),qe({withTransform:!0})},Ce.toDonut=function(a){pd(a,"donut"),qe({withTransform:!0})},Ce.groups=function(a){return c(a)?Hf:(Hf=a,le(),Hf)},Ce.xgrids=function(a){return a?(Ig=a,le(),Ig):Ig},Ce.xgrids.add=function(a){return a?Ce.xgrids(Ig.concat(a)):void 0},Ce.xgrids.remove=function(a){var b=Ae(a);return Ce.xgrids(Ig.filter(b))},Ce.ygrids=function(a){return a?(Kg=a,le(),Kg):Kg},Ce.ygrids.add=function(a){return a?Ce.ygrids(Kg.concat(a)):void 0},Ce.ygrids.remove=function(a){var b=Ae(a);return Ce.ygrids(Kg.filter(b))},Ce.regions=function(a){return c(a)?bh:(bh=a,le(),bh)},Ce.regions.add=function(a){return c(a)?bh:(bh=bh.concat(a),le(),bh)},Ce.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Kh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),bh=bh.filter(function(b){return b.classes.indexOf(a)<0})}),bh},Ce.data.get=function(a){var b=Ce.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ce.data.getAsTarget=function(a){var b=qc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ce.resize=function(a){Je=a?a.width:null,Ke=a?a.height:null,qe({withLegend:!0,withTransition:!1})},Ce.destroy=function(){Ce.data.targets=void 0,Ce.data.x={},Qh.html(""),a.onresize=null},"url"in e.data)Be.csv(e.data.url,function(a,b){ee(b)});else if("rows"in e.data)ee(gc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ee(hc(e.data.columns))}return Ce},"function"==typeof a.define&&a.define.amd?a.define(e):a.c3=e}(window); \ No newline at end of file