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