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