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