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