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