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