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