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