Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2 lines
59 KiB

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