Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

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