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