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.
 
 
 
 

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