mirror of https://github.com/masayuki0812/c3.git
Masayuki Tanaka
11 years ago
2 changed files with 103 additions and 102 deletions
@ -1,90 +1,90 @@
|
||||
(function(N){function wd(){function R(e,g){e.attr("transform",function(e){return"translate("+(g(e)+ga)+", 0)"})}function x(e,g){e.attr("transform",function(e){return"translate(0,"+g(e)+")"})}function y(e){var g=e[0];e=e[e.length-1];return g<e?[g,e]:[e,g]}function z(e){for(var g=[],q=Math.ceil(e[0]);q<e[1];q++)g.push(q);0<g.length&&0<g[0]&&g.unshift(g[0]-(g[1]-g[0]));return g}function N(e){e=e<X.length?X[e]:e;return S?S(e):e}function p(p){p.each(function(){var p=e.select(this),pa=z(q.domain()),Y=p.selectAll(".tick.major").data(pa, |
||||
String),Z=Y.enter().insert("g","path").attr("class","tick major").style("opacity",1E-6),ha=e.transition(Y.exit()).style("opacity",1E-6).remove(),ia=e.transition(Y).style("opacity",1),J,u=q.rangeExtent?q.rangeExtent():y(q.range()),p=p.selectAll(".domain").data([0]);p.enter().append("path").attr("class","domain");var p=e.transition(p),C=q.copy(),X=this.__chart__||C;this.__chart__=C;Z.append("line");Z.append("text");var T=Z.select("line"),S=ia.select("line"),$=Y.select("text"),ab=Z.select("text"),Ia= |
||||
ia.select("text");ga=(C(1)-C(0))/2;Y=wa?0:ga;switch(D){case "bottom":J=R;T.attr("y2",O);ab.attr("y",Math.max(O,0)+g);S.attr("x1",Y).attr("x2",Y).attr("y2",O);Ia.attr("x",0).attr("y",Math.max(O,0)+g);$.attr("dy",".71em").style("text-anchor","middle");$.text(function(e){return pa.length<U||0===e%Math.ceil(pa.length/U)?N(e):""});p.attr("d","M"+u[0]+","+aa+"V0H"+u[1]+"V"+aa);break;case "left":J=x,T.attr("x2",-O),ab.attr("x",-(Math.max(O,0)+g)),S.attr("x2",-O).attr("y2",0),Ia.attr("x",-(Math.max(O,0)+ |
||||
g)).attr("y",ga),$.attr("dy",".32em").style("text-anchor","end"),$.text(function(e){return pa.length<U||0===e%Math.ceil(pa.length/U)?N(e):""}),p.attr("d","M"+-aa+","+u[0]+"H0V"+u[1]+"H"+-aa)}if(q.ticks)Z.call(J,X),ia.call(J,C),ha.call(J,C);else{var Ab=C.rangeBand()/2,ha=function(e){return C(e)+Ab};Z.call(J,ha);ia.call(J,ha)}})}var q=e.scale.linear(),D="bottom",O=6,aa=6,g=3,wa=!1,U=10,ga=0,S=null,X=[];p.scale=function(e){if(!arguments.length)return q;q=e;return p};p.orient=function(e){if(!arguments.length)return D; |
||||
D=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom";return p};p.categories=function(e){if(!arguments.length)return X;X=e;return p};p.tickCentered=function(e){if(!arguments.length)return wa;wa=e;return p};p.tickTextNum=function(e){if(!arguments.length)return U;U=e;return p};p.tickFormat=function(e){if(!arguments.length)return S;S=e;return p};p.tickOffset=function(){return ga};p.ticks=function(){};return p}function z(e){return e||0===e}function x(e){return"undefined"===typeof e}function y(e){return"undefined"!== |
||||
typeof e}var Bb=N.c3={},e=N.d3;Bb.generate=function(R){var qc,rc,yb,sc,p,q,D,O,aa;function g(a,b){for(var c=R,d=0;d<a.length;d++){if(!(a[d]in c))return b;c=c[a[d]]}return c}function wa(){Cb=Ja?Ja:S();xa=ga();q=0;D=(h?Db+uc:0)+(bb?bb:cb?1:40);O=20+(h?0:Db)+qa;aa=db?db:Eb?eb||h?1:40:1;r=Cb-D-aa;s=xa-q-O;yb=h?q:xa-Db-qa;sc=h?vc:D;p=20+qa;Fb=h?D-vc-uc:r;fb=h?s:xa-yb-p;qc=xa-qa;rc=D;U()}function U(){Gb=s/2;Ka=0.95*Gb;Hb=ja(k.data.targets,"donut")?0.6*Ka:0}function ga(){var a=Ib?Ib:+e.select(ya).style("height").replace("px", |
||||
"");return 0<a?a:320}function S(){return+e.select(ya).style("width").replace("px","")}function X(){return r+2+D+aa}function pa(){return 40}function Bb(){return D+20}function xd(){return s-q+2}function Y(){var a=h?s:r,b=za(ba)/za(m.domain()),c=gb();return 1<c?a*b/(c-1):a}function Z(){Jb=h?1:0;Kb=h?s:r;Lb=h?0:s;Mb=h?r:1;Nb=h?0:fb;Ob=h?Fb:1;m=ia(Jb,Kb,m?m.domain():void 0,function(){return K.tickOffset()});A=J(Lb,Mb,A?A.domain():void 0);ca=J(Lb,Mb,ca?ca.domain():void 0);V=ia(Jb,Kb,ba,function(a){return a% |
||||
1?0:La.tickOffset()});hb=J(Nb,Ob);ib=J(Nb,Ob);K=tc(m,zd,zb());Aa=e.svg.axis().scale(A).orient(Ad).tickFormat(Pb);jb=e.svg.axis().scale(ca).orient(Bd).tickFormat(Cd);La=tc(V,Dd,zb());ha()}function ha(){kb=ab();wc=Ia();xc=Ia(0.98)}function ia(a,b,c,d){var f=(E?e.time.scale():e.scale.linear()).range([a,b]);f.orgDomain=function(){return f.domain()};y(c)&&f.domain(c);x(d)&&(d=function(){return 0});if(ka){var I=f,t,f=function(a){return I(a)+d(a)};for(t in I)f[t]=I[t];f.orgDomain=function(){return I.domain()}; |
||||
f.domain=function(a){if(!arguments.length)return a=I.domain(),[a[0],a[1]+1];I.domain(a);return f}}return f}function J(a,b){return e.scale.linear().range([a,b])}function u(a){return"y2"===T(a)?ca:A}function C(a){return"y2"===T(a)?ib:hb}function tc(a,b,c){a=(ka?wd():e.svg.axis()).scale(a).orient(b);a.tickFormat(c);ka?a.categories(Ma).tickCentered(Ed):a.tickOffset=function(){return 0};return a}function T(a){return a in yc?yc[a]:"y"}function zb(){var a=E?Fd:ka?Gd:null;lb&&("function"===typeof lb?a=lb: |
||||
E&&(a=function(a){return e.time.format(lb)(a)}));return a}function $(a){var b=!1;Qb(k.data.targets).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)});return b?a:null}function ab(){var a=e.svg.arc().outerRadius(Ka).innerRadius(Hb),b=function(b,d){var f;return d?a(b):(f=$(b))?a(f):"M 0 0"};b.centroid=a.centroid;return b}function Ia(a){var b=e.svg.arc().outerRadius(Gb*(a?a:1)).innerRadius(Hb);return function(a){return(a=$(a))?b(a):"M 0 0"}}function Ab(a){a=$(a);var b,c;b="";a&&(b=kb.centroid(a), |
||||
a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b="translate("+0.8*(a/c)*Ka+","+0.8*(b/c)*Ka+")");return b}function yd(a){return Hd(a,(a.endAngle-a.startAngle)/(2*Math.PI))}function zc(a,b){var c=n.selectAll(".chart-arc"+la(a)),d=n.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",wc).transition().duration(100).attr("d",xc).each(function(a){Rb(a.data)});b||d.style("opacity",0.3)}function Sb(a){n.selectAll(".chart-arc"+la(a)).selectAll("path").transition().duration(50).attr("d", |
||||
kb);n.selectAll(".-arc").style("opacity",1)}function Id(a){var b=Ac(a),c,d,f,I;if(0<v.length)for(I=Bc(a),a=0;a<v.length;a++)for(d=v[a][0],I&&b[d]&&b[d].forEach(function(a,c){b[d][c]=0>a?a:0}),c=1;c<v[a].length;c++)f=v[a][c],b[f]&&b[f].forEach(function(a,c){T(f)!==T(d)||!b[d]||I&&0<+a||(b[d][c]+=+a)});return e.min(Object.keys(b).map(function(a){return e.min(b[a])}))}function Jd(a){var b=Ac(a),c,d,f,I;if(0<v.length)for(I=Kd(a),a=0;a<v.length;a++)for(d=v[a][0],I&&b[d]&&b[d].forEach(function(a,c){b[d][c]= |
||||
0<a?a:0}),c=1;c<v[a].length;c++)f=v[a][c],b[f]&&b[f].forEach(function(a,c){T(f)!==T(d)||!b[d]||I&&0>+a||(b[d][c]+=+a)});return e.max(Object.keys(b).map(function(a){return e.max(b[a])}))}function mb(a){var b=nb(function(b){return T(b.id)===a}),c="y2"===a?Ld:Md,d="y2"===a?Nd:Od,c=c?c:Id(b),d=d?d:Jd(b),f=0.1*Math.abs(d-c),e=f,g=f,h="y2"===a?Pd:Qd;h&&(c=Math.max(Math.abs(c),Math.abs(d)),d=c-h,c=h-c);"y"===a&&Na&&(e=z(Na.top)?Na.top:f,g=z(Na.bottom)?Na.bottom:f);"y2"===a&&Oa&&(e=z(Oa.top)?Oa.top:f,g=z(Oa.bottom)? |
||||
Oa.bottom:f);ja(b,"bar")&&!Bc(b)&&(g=c);return[c-g,d+e]}function Rd(a){return e.min(a,function(a){return e.min(a.values,function(a){return a.x})})}function Sd(a){return e.max(a,function(a){return e.max(a.values,function(a){return a.x})})}function ob(a){var b=[Rd(a),Sd(a)];a=b[0];var b=b[1],c=ka?0:0.01*Math.abs(a-b);a=E?new Date(a.getTime()-c):a-c;b=E?new Date(b.getTime()+c):b+c;return[a,b]}function za(a){return a[1]-a[0]}function Td(a){for(var b=0;b<a.length;b++)if(!(a[b]in pb))return!1;return!0} |
||||
function Ud(a){for(var b=[],c=0;c<a.length;c++)a[c]in pb&&b.push(Cc(pb[a[c]]));return b}function Tb(a){return"start"in a?m(E?ra(a.start):a.start):0}function Dc(a){var b=Tb(a);a=("end"in a?m(E?ra(a.end):a.end):r)-b;return 0>a?0:a}function Ec(a){return sa&&a===sa||da&&Vd(da,a)}function Wd(a){return!Ec(a)}function Xd(a){Object.keys(a).forEach(function(b){da[b]=a[b]})}function qb(a){var b;a&&(b=Pa[a.id],a.name=b?b:a.id);return a}function Fc(a){var b=a[0],c={},d=[],f,e;for(f=1;f<a.length;f++){c={};for(e= |
||||
0;e<a[f].length;e++)c[b[e]]=a[f][e];d.push(c)}return d}function Gc(a){var b=[],c,d,f;for(c=0;c<a.length;c++)for(f=a[c][0],d=1;d<a[c].length;d++)x(b[d-1])&&(b[d-1]={}),b[d-1][f]=a[c][d];return b}function Qa(a){var b=e.keys(a[0]).filter(Wd),c=e.keys(a[0]).filter(Ec);if(E&&0===c.length)return N.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Ub&&b.forEach(function(b){var f=sa?sa:da?da[b]:null;0<=c.indexOf(f)?k.data.x[b]=a.map(function(a){return a[f]}):k.data.x[b]=k.data.x[Object.keys(k.data.x)[0]]}); |
||||
b=b.map(function(b){var c=Yd(b);return{id:c,id_org:b,values:a.map(function(a,e){var g;g=sa?sa:da?da[b]:null;g=E?ra(a[g]):Ub?a[g]?+a[g]:b in k.data.x&&k.data.x[b]&&k.data.x[b][e]?k.data.x[b][e]:e:e;a.x=g;return{x:g,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){return(a.x||0===a.x?a.x:Infinity)-(b.x||0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});Hc&&ea(Ra(b).filter(function(a){return!(a in B)}),Hc);b.forEach(function(a){pb[a.id_org]= |
||||
Cc(a)});return b}function Cc(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 Ic(a){return 0<a&&k.data.targets[0].values[a-1]?k.data.targets[0].values[a-1].x:void 0}function gb(){return e.max(k.data.targets,function(a){return a.values.length})}function Zd(){var a=k.data.targets.length,b=0,c;1<a?k.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?k.data.targets[0]:null;return c}function Ra(a){a=x(a)?k.data.targets: |
||||
a;return a.map(function(a){return a.id})}function Jc(a){var b=Ra(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function nb(a){return y(a)?k.data.targets.filter(a):k.data.targets}function Ac(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(d){b[a.id].push(d.value)})});return b}function Kc(a,b){var c=Object.keys(a),d,f,e;for(d=0;d<c.length;d++)for(e=a[c[d]].values,f=0;f<e.length;f++)if(b(e[f].value))return!0;return!1}function Bc(a){return Kc(a,function(a){return 0>a})} |
||||
function Kd(a){return Kc(a,function(a){return 0<a})}function Gd(a){return a<Ma.length?Ma[a]:a}function Sa(a){return"-shapes -shapes-"+a.id}function Lc(a){return Sa(a)+" -line -line-"+a.id}function $d(a){return Sa(a)+" -circles -circles-"+a.id}function Mc(a){return Sa(a)+" -bars -bars-"+a.id}function ae(a){return Sa(a.data)+" -arc -arc-"+a.data.id}function be(a){return Sa(a)+" -area -area-"+a.id}function ce(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Nc(a,b){return"-shape -shape-"+ |
||||
b+" -bar -bar-"+b}function de(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Oc(a,b){return"event-rect event-rect-"+b}function ee(a){return z(a.value)?Pc(a)?0.5:1:0}function Ba(a){return a?m(a.x):null}function Ta(a){return m(E?ra(a.value):a.value)}function Ua(a){return A(a.value)}function Qc(a){return V(a.x)}function Rc(a,b){var c,d=a[b].x,f=[];for(c=b-1;0<=c&&d===a[c].x;c--)f.push(a[c]);for(c=b;c<a.length&&d===a[c].x;c++)f.push(a[c]);return f}function Sc(a, |
||||
b,c,d){c=c?c:0;d=d?d:a.length-1;var f=Math.floor((d-c)/2)+c;0<m(a[f].x)-b[0]?d=f:c=f;return 1===d-c?(f=[],a[c].x&&(f=f.concat(Rc(a,c))),a[d].x&&(f=f.concat(Rc(a,d))),Tc(f,b)):Sc(a,b,c,d)}function Uc(a,b){var c;c=a.map(function(a){return Sc(a.values,b)});return Tc(c,b)}function Tc(a,b){var c,d;a.forEach(function(a){var e=Vb(a,b);if(e<c||!c)c=e,d=a});return d}function Vc(a,b){var c,d,f,e,g;e=a.filter(function(a){return a&&z(a.value)});Wc&&0!==e.length&&(W.html(Xc(a)).style("visibility","hidden").style("display", |
||||
"block"),c=W.property("offsetWidth"),d=W.property("offsetHeight"),h?e=b[0]:(f=n.property("offsetLeft"),e=f+(bb?bb:cb?1:40)+m(e[0].x)+20,g=e+c,f=f+(Ja?Ja:S())-(db?db:Eb?eb||h?1:40:1),g>f&&(e-=c+30)),c=b[1]+15+d<ga()?b[1]+15:b[1]-d,W.style("top",c+"px").style("left",e+"px").style("visibility","visible"))}function Yc(a){a=a.filter(function(a){return a&&z(a.value)});Wc&&(ja(k.data.targets,"scatter")||F(k.data.targets)||l.selectAll("line.xgrid-focus").style("visibility","visible").data([a[0]]).attr(h? |
||||
"y1":"x1",Ba).attr(h?"y2":"x2",Ba))}function Zc(){l.select("line.xgrid-focus").style("visibility","hidden")}function Ca(a){return a.x||0===a.x?m(a.x):null}function Da(a){return u(a.id)(a.value)}function fe(){var a={},b=0,c,d;nb(rb).forEach(function(f){for(c=0;c<v.length;c++)if(!(0>v[c].indexOf(f.id)))for(d=0;d<v[c].length;d++)if(v[c][d]in a){a[f.id]=a[v[c][d]];break}x(a[f.id])&&(a[f.id]=b++)});a.__max__=b-1;return a}function ge(a,b,c,d){var f=d?V:m;return b?function(d){var e=d.id in c?c[d.id]:0;return d.x|| |
||||
0===d.x?f(d.x)-a*(b/2-e):0}:function(){return 0}}function he(a){return function(b){return(a?C(b.id):u(b.id))(b.value)}}function ie(a,b){var c=Object.keys(a);return function(d,f){var e=b?C(d.id):u(d.id),g=e(0),h=g;nb(rb).forEach(function(b){b.id!==d.id&&a[b.id]===a[d.id]&&c.indexOf(b.id)<c.indexOf(d.id)&&0<b.values[f].value*d.value&&(h+=e(b.values[f].value)-g)});return h}}function ea(a,b){var c=x(a)?Ra():a;"string"===typeof c&&(c=[c]);for(var d=0;d<c.length;d++)Wb[c[d]]=b===B[c[d]],B[c[d]]=b}function ja(a, |
||||
b){var c=!1;a.forEach(function(a){B[a.id]===b&&(c=!0);a.id in B||"line"!==b||(c=!0)});return c}function Va(a){return Wb[a.id]?1:0}function F(a){return ja(a,"pie")||ja(a,"donut")}function Xb(a){a="string"===typeof a?a:a.id;return!(a in B)||"line"===B[a]||"spline"===B[a]||"area"===B[a]||"area-spline"===B[a]}function $c(a){a="string"===typeof a?a:a.id;return"spline"===B[a]||"area-spline"===B[a]}function rb(a){return"bar"===B["string"===typeof a?a:a.id]}function Pc(a){return"scatter"===B["string"===typeof a? |
||||
a:a.id]}function ad(a){return"pie"===B["string"===typeof a?a:a.id]}function Rb(a){return"donut"===B["string"===typeof a?a:a.id]}function bd(a){return rb(a)?a.values:[]}function je(a){return Xb(a)||Pc(a)?a.values:[]}function ra(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Yb+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");b=e.time.format(Yb).parse(a);if(!b)throw Error("Failed to parse '"+a+"' with format "+Yb);return b}function cd(a,b){var c=e.mouse(a), |
||||
d=e.select(a),f=1*d.attr("cx"),d=1*d.attr("cy");return Math.sqrt(Math.pow(f-c[0],2)+Math.pow(d-c[1],2))<b}function dd(a){var b=e.mouse(a),c=e.select(a);a=1*c.attr("x");var d=1*c.attr("y"),c=1*c.attr("width");return a-10<b[0]&&b[0]<a+c+10&&d-10<b[1]}function ke(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 Vd(a,b){var c=!1;Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)});return c}function Vb(a,b){return Math.pow(m(a.x)-b[0],2)+Math.pow(A(a.value)-b[1], |
||||
2)}function ed(a,b,c){le(a,b);l.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",h?Da:Ca).attr("cy",h?Ca:Da).attr("stroke",function(){return P(b.id)}).attr("r",1.4*Wa).transition().duration(100).attr("r",Wa)}function Zb(a,b,c){me(a,b);l.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).transition().duration(100).attr("r",0).remove()}function fd(a,b,c, |
||||
d){a?ed(b,c,d):Zb(b,c,d)}function ne(){}function gd(){}function hd(a,b,c,d){}function $b(a){return a.filter(function(a){return z(a.value)})}function ac(a,b){return(b?l.selectAll(".-circles-"+b):l).selectAll(".-circle"+(z(a)?"-"+a:""))}function bc(a){ac(a).filter(function(){return e.select(this).classed(fa)}).classed(fa,!1).attr("r",cc)}function oe(a,b,c,d){var f,e,g="M",k,l,m,id,n,ta=[];if(y(d))for(f=0;f<d.length;f++)ta[f]={},x(d[f].start)?ta[f].start=a[0].x:ta[f].start=E?ra(d[f].start):d[f].start, |
||||
x(d[f].end)?ta[f].end=a[a.length-1].x:ta[f].end=E?ra(d[f].end):d[f].end;id=h?function(a){return c(a.value)}:function(a){return b(a.x)};n=h?function(a){return b(a.x)}:function(a){return c(a.value)};d=E?function(a,d,f,e){var g=a.x.getTime();a=d.x-a.x;d=new Date(g+a*(f+e));return"M"+b(new Date(g+a*f))+" "+c(l(f))+" "+b(d)+" "+c(l(f+e))}:function(a,d,f,e){return"M"+b(k(f))+" "+c(l(f))+" "+b(k(f+e))+" "+c(l(f+e))};for(f=0;f<a.length;f++)if(x(ta)||!ke(a[f].x,ta))g+=" "+id(a[f])+" "+n(a[f]);else{k=ia(a[f- |
||||
1].x,a[f].x);l=J(a[f-1].value,a[f].value);e=b(a[f].x)-b(a[f-1].x);m=c(a[f].value)-c(a[f-1].value);e=Math.sqrt(Math.pow(e,2)+Math.pow(m,2));m=2/e;var p=2*m;for(e=m;1>=e;e+=p)g+=d(a[f-1],a[f],e,m)}return g}function dc(a){var b;sb=e.select(ya);if(sb.empty())N.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{sb.html("");k.data.x={};k.data.targets=Qa(a);wa();Z();m.domain(e.extent(ob(k.data.targets)));A.domain(mb("y")); |
||||
ca.domain(mb("y2"));V.domain(m.domain());hb.domain(A.domain());ib.domain(ca.domain());K.ticks(10>a.length?a.length:10);La.ticks(10>a.length?a.length:10);Aa.ticks(pe).outerTickSize(0);jb.ticks(qe).outerTickSize(0);ba=m.domain();L.scale(V);ua&&G.scale(m);n=e.select(ya).append("svg").attr("width",r+D+aa).attr("height",s+q+O).on("mouseenter",re).on("mouseleave",se);tb=n.append("defs");tb.append("clipPath").attr("id",ec).append("rect").attr("y",q).attr("width",r).attr("height",s-q);tb.append("clipPath").attr("id", |
||||
"xaxis-clip").append("rect").attr("x",-1-D).attr("y",-20).attr("width",X).attr("height",pa);tb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-D+1).attr("y",q-1).attr("width",Bb).attr("height",xd);l=n.append("g").attr("transform",M.main);H=Ea?n.append("g").attr("transform",M.context):null;Fa=Ga?n.append("g").attr("transform",M.legend):null;W=e.select(ya).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none");l.append("g").attr("class", |
||||
"x axis").attr("clip-path",h?"":"url("+document.URL+"#xaxis-clip)").attr("transform",M.x).call(h?Aa:K).append("text").attr("class","-axis-x-label").attr("x",r).attr("dy","-.5em").style("text-anchor","end").text(te);l.append("g").attr("class","y axis").attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").call(h?K:Aa).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(ue);Eb&&l.append("g").attr("class","y2 axis").attr("transform", |
||||
M.y2).call(jb);a=l.append("g").attr("clip-path",Xa).attr("class","grid");jd&&a.append("g").attr("class","xgrids");fc&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(fc).enter().append("g").attr("class","xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",h?"":"rotate(-90)").attr("dx",h?0:-q).attr("dy",-5).text(function(a){return a.text})); |
||||
ve&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",h?0:-10).attr("x2",h?r:-10).attr("y1",h?-10:q).attr("y2",h?-10:s);kd&&a.append("g").attr("class","ygrids");gc&&(a=a.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(gc).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform", |
||||
(function(M){function wd(){function R(e,g){e.attr("transform",function(e){return"translate("+(g(e)+fa)+", 0)"})}function x(e,g){e.attr("transform",function(e){return"translate(0,"+g(e)+")"})}function y(e){var g=e[0];e=e[e.length-1];return g<e?[g,e]:[e,g]}function z(e){for(var g=[],q=Math.ceil(e[0]);q<e[1];q++)g.push(q);0<g.length&&0<g[0]&&g.unshift(g[0]-(g[1]-g[0]));return g}function M(e){e=e<X.length?X[e]:e;return S?S(e):e}function p(p){p.each(function(){var p=e.select(this),oa=z(q.domain()),Y=p.selectAll(".tick.major").data(oa, |
||||
String),Z=Y.enter().insert("g","path").attr("class","tick major").style("opacity",1E-6),ga=e.transition(Y.exit()).style("opacity",1E-6).remove(),ha=e.transition(Y).style("opacity",1),J,u=q.rangeExtent?q.rangeExtent():y(q.range()),p=p.selectAll(".domain").data([0]);p.enter().append("path").attr("class","domain");var p=e.transition(p),C=q.copy(),X=this.__chart__||C;this.__chart__=C;Z.append("line");Z.append("text");var T=Z.select("line"),S=ha.select("line"),wa=Y.select("text"),pa=Z.select("text"),ab= |
||||
ha.select("text");fa=(C(1)-C(0))/2;Y=xa?0:fa;switch(D){case "bottom":J=R;T.attr("y2",N);pa.attr("y",Math.max(N,0)+g);S.attr("x1",Y).attr("x2",Y).attr("y2",N);ab.attr("x",0).attr("y",Math.max(N,0)+g);wa.attr("dy",".71em").style("text-anchor","middle");wa.text(function(e){return oa.length<U||0===e%Math.ceil(oa.length/U)?M(e):""});p.attr("d","M"+u[0]+","+$+"V0H"+u[1]+"V"+$);break;case "left":J=x,T.attr("x2",-N),pa.attr("x",-(Math.max(N,0)+g)),S.attr("x2",-N).attr("y2",0),ab.attr("x",-(Math.max(N,0)+ |
||||
g)).attr("y",fa),wa.attr("dy",".32em").style("text-anchor","end"),wa.text(function(e){return oa.length<U||0===e%Math.ceil(oa.length/U)?M(e):""}),p.attr("d","M"+-$+","+u[0]+"H0V"+u[1]+"H"+-$)}if(q.ticks)Z.call(J,X),ha.call(J,C),ga.call(J,C);else{var bb=C.rangeBand()/2,ga=function(e){return C(e)+bb};Z.call(J,ga);ha.call(J,ga)}})}var q=e.scale.linear(),D="bottom",N=6,$=6,g=3,xa=!1,U=10,fa=0,S=null,X=[];p.scale=function(e){if(!arguments.length)return q;q=e;return p};p.orient=function(e){if(!arguments.length)return D; |
||||
D=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom";return p};p.categories=function(e){if(!arguments.length)return X;X=e;return p};p.tickCentered=function(e){if(!arguments.length)return xa;xa=e;return p};p.tickTextNum=function(e){if(!arguments.length)return U;U=e;return p};p.tickFormat=function(e){if(!arguments.length)return S;S=e;return p};p.tickOffset=function(){return fa};p.ticks=function(){};return p}function z(e){return e||0===e}function x(e){return"undefined"===typeof e}function y(e){return"undefined"!== |
||||
typeof e}var zb=M.c3={},e=M.d3;zb.generate=function(R){var pc,qc,yb,rc,p,q,D,N,$;function g(a,b){for(var c=R,d=0;d<a.length;d++){if(!(a[d]in c))return b;c=c[a[d]]}return c}function xa(){Ab=Ia?Ia:S();ya=fa();q=0;D=(h?Bb+uc:0)+(cb?cb:db?1:40);N=20+(h?0:Bb)+qa;$=eb?eb:Cb?fb||h?1:40:1;r=Ab-D-$;s=ya-q-N;yb=h?q:ya-Bb-qa;rc=h?vc:D;p=20+qa;Db=h?D-vc-uc:r;gb=h?s:ya-yb-p;pc=ya-qa;qc=D;U()}function U(){Eb=s/2;Ja=0.95*Eb;Fb=ia(k.data.targets,"donut")?0.6*Ja:0}function fa(){var a=Gb?Gb:+e.select(za).style("height").replace("px", |
||||
"");return 0<a?a:320}function S(){return+e.select(za).style("width").replace("px","")}function X(){return r+2+D+$}function oa(){return 40}function zb(){return D+20}function xd(){return s-q+2}function Y(){var a=h?s:r,b=Aa(aa)/Aa(m.domain()),c=Ka();return 1<c?a*b/(c-1):a}function Z(){var a,b;Hb=h?1:0;Ib=h?s:r;Jb=h?0:s;Kb=h?r:1;Lb=h?0:gb;Mb=h?Db:1;m=ha(Hb,Ib,m?m.domain():void 0,function(){return O.tickOffset()});A=J(Jb,Kb,A?A.domain():void 0);ba=J(Jb,Kb,ba?ba.domain():void 0);V=ha(Hb,Ib,aa,function(a){return a% |
||||
1?0:hb.tickOffset()});ib=J(Lb,Mb);jb=J(Lb,Mb);a=tc();b=wa();O=sc(m,zd,a,b);hb=sc(V,Ad,a,b);La=e.svg.axis().scale(A).orient(Bd).tickFormat(Nb).ticks(Cd).outerTickSize(0);Ob=e.svg.axis().scale(ba).orient(Dd).tickFormat(Ed).ticks(Fd).outerTickSize(0);ga()}function ga(){kb=ab();wc=bb();xc=bb(0.98)}function ha(a,b,c,d){var f=(E?e.time.scale():e.scale.linear()).range([a,b]);f.orgDomain=function(){return f.domain()};y(c)&&f.domain(c);x(d)&&(d=function(){return 0});if(ja){var I=f,t,f=function(a){return I(a)+ |
||||
d(a)};for(t in I)f[t]=I[t];f.orgDomain=function(){return I.domain()};f.domain=function(a){if(!arguments.length)return a=I.domain(),[a[0],a[1]+1];I.domain(a);return f}}return f}function J(a,b){return e.scale.linear().range([a,b])}function u(a){return"y2"===T(a)?ba:A}function C(a){return"y2"===T(a)?jb:ib}function sc(a,b,c,d){a=(ja?wd():e.svg.axis()).scale(a).orient(b);a.tickFormat(c).ticks(d);ja?a.categories(Ma).tickCentered(Gd):a.tickOffset=function(){return 0};return a}function T(a){return a in yc? |
||||
yc[a]:"y"}function tc(){var a=E?Hd:ja?Id:null;lb&&("function"===typeof lb?a=lb:E&&(a=function(a){return e.time.format(lb)(a)}));return a}function wa(){var a=Ka();return 10>a?a:10}function pa(a){var b=!1;Pb(k.data.targets).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)});return b?a:null}function ab(){var a=e.svg.arc().outerRadius(Ja).innerRadius(Fb),b=function(b,d){var f;return d?a(b):(f=pa(b))?a(f):"M 0 0"};b.centroid=a.centroid;return b}function bb(a){var b=e.svg.arc().outerRadius(Eb*(a? |
||||
a:1)).innerRadius(Fb);return function(a){return(a=pa(a))?b(a):"M 0 0"}}function yd(a){a=pa(a);var b,c;b="";a&&(b=kb.centroid(a),a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b="translate("+0.8*(a/c)*Ja+","+0.8*(b/c)*Ja+")");return b}function Jd(a){return Kd(a,(a.endAngle-a.startAngle)/(2*Math.PI))}function zc(a,b){var c=n.selectAll(".chart-arc"+ka(a)),d=n.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",wc).transition().duration(100).attr("d", |
||||
xc).each(function(a){Qb(a.data)});b||d.style("opacity",0.3)}function Rb(a){n.selectAll(".chart-arc"+ka(a)).selectAll("path").transition().duration(50).attr("d",kb);n.selectAll(".-arc").style("opacity",1)}function Ld(a){var b=Ac(a),c,d,f,I;if(0<v.length)for(I=Bc(a),a=0;a<v.length;a++)for(d=v[a][0],I&&b[d]&&b[d].forEach(function(a,c){b[d][c]=0>a?a:0}),c=1;c<v[a].length;c++)f=v[a][c],b[f]&&b[f].forEach(function(a,c){T(f)!==T(d)||!b[d]||I&&0<+a||(b[d][c]+=+a)});return e.min(Object.keys(b).map(function(a){return e.min(b[a])}))} |
||||
function Md(a){var b=Ac(a),c,d,f,I;if(0<v.length)for(I=Nd(a),a=0;a<v.length;a++)for(d=v[a][0],I&&b[d]&&b[d].forEach(function(a,c){b[d][c]=0<a?a:0}),c=1;c<v[a].length;c++)f=v[a][c],b[f]&&b[f].forEach(function(a,c){T(f)!==T(d)||!b[d]||I&&0>+a||(b[d][c]+=+a)});return e.max(Object.keys(b).map(function(a){return e.max(b[a])}))}function mb(a){var b=nb(function(b){return T(b.id)===a}),c="y2"===a?Od:Pd,d="y2"===a?Qd:Rd,c=c?c:Ld(b),d=d?d:Md(b),f=0.1*Math.abs(d-c),e=f,g=f,h="y2"===a?Sd:Td;h&&(c=Math.max(Math.abs(c), |
||||
Math.abs(d)),d=c-h,c=h-c);"y"===a&&Na&&(e=z(Na.top)?Na.top:f,g=z(Na.bottom)?Na.bottom:f);"y2"===a&&Oa&&(e=z(Oa.top)?Oa.top:f,g=z(Oa.bottom)?Oa.bottom:f);ia(b,"bar")&&!Bc(b)&&(g=c);return[c-g,d+e]}function Ud(a){return e.min(a,function(a){return e.min(a.values,function(a){return a.x})})}function Vd(a){return e.max(a,function(a){return e.max(a.values,function(a){return a.x})})}function ob(a){var b=[Ud(a),Vd(a)];a=b[0];var b=b[1],c=ja?0:0.01*Math.abs(a-b);a=E?new Date(a.getTime()-c):a-c;b=E?new Date(b.getTime()+ |
||||
c):b+c;return[a,b]}function Aa(a){return a[1]-a[0]}function Wd(a){for(var b=0;b<a.length;b++)if(!(a[b]in pb))return!1;return!0}function Xd(a){for(var b=[],c=0;c<a.length;c++)a[c]in pb&&b.push(Cc(pb[a[c]]));return b}function Sb(a){return"start"in a?m(E?ra(a.start):a.start):0}function Dc(a){var b=Sb(a);a=("end"in a?m(E?ra(a.end):a.end):r)-b;return 0>a?0:a}function Ec(a){return sa&&a===sa||ca&&Yd(ca,a)}function Zd(a){return!Ec(a)}function $d(a){Object.keys(a).forEach(function(b){ca[b]=a[b]})}function qb(a){var b; |
||||
a&&(b=Pa[a.id],a.name=b?b:a.id);return a}function Fc(a){var b=a[0],c={},d=[],f,e;for(f=1;f<a.length;f++){c={};for(e=0;e<a[f].length;e++)c[b[e]]=a[f][e];d.push(c)}return d}function Gc(a){var b=[],c,d,f;for(c=0;c<a.length;c++)for(f=a[c][0],d=1;d<a[c].length;d++)x(b[d-1])&&(b[d-1]={}),b[d-1][f]=a[c][d];return b}function Qa(a){var b=e.keys(a[0]).filter(Zd),c=e.keys(a[0]).filter(Ec);if(E&&0===c.length)return M.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"'),[];Tb&&b.forEach(function(b){var f= |
||||
sa?sa:ca?ca[b]:null;0<=c.indexOf(f)?k.data.x[b]=a.map(function(a){return a[f]}):k.data.x[b]=k.data.x[Object.keys(k.data.x)[0]]});b=b.map(function(b){var c=ae(b);return{id:c,id_org:b,values:a.map(function(a,e){var g;g=sa?sa:ca?ca[b]:null;g=E?ra(a[g]):Tb?a[g]?+a[g]:b in k.data.x&&k.data.x[b]&&k.data.x[b][e]?k.data.x[b][e]:e:e;a.x=g;return{x:g,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){return(a.x||0===a.x?a.x:Infinity)-(b.x|| |
||||
0===b.x?b.x:Infinity)});b=0;a.values.forEach(function(a){a.index=b++})});Hc&&da(Ra(b).filter(function(a){return!(a in B)}),Hc);b.forEach(function(a){pb[a.id_org]=Cc(a)});return b}function Cc(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 Ic(a){return 0<a&&k.data.targets[0].values[a-1]?k.data.targets[0].values[a-1].x:void 0}function Ka(){return e.max(k.data.targets,function(a){return a.values.length})}function be(){var a=k.data.targets.length, |
||||
b=0,c;1<a?k.data.targets.forEach(function(a){a.values.length>b&&(c=a,b=a.values.length)}):c=a?k.data.targets[0]:null;return c}function Ra(a){a=x(a)?k.data.targets:a;return a.map(function(a){return a.id})}function Jc(a){var b=Ra(),c;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1}function nb(a){return y(a)?k.data.targets.filter(a):k.data.targets}function Ac(a){var b={};a.forEach(function(a){b[a.id]=[];a.values.forEach(function(d){b[a.id].push(d.value)})});return b}function Kc(a,b){var c=Object.keys(a), |
||||
d,f,e;for(d=0;d<c.length;d++)for(e=a[c[d]].values,f=0;f<e.length;f++)if(b(e[f].value))return!0;return!1}function Bc(a){return Kc(a,function(a){return 0>a})}function Nd(a){return Kc(a,function(a){return 0<a})}function Id(a){return a<Ma.length?Ma[a]:a}function Sa(a){return"-shapes -shapes-"+a.id}function Lc(a){return Sa(a)+" -line -line-"+a.id}function ce(a){return Sa(a)+" -circles -circles-"+a.id}function Mc(a){return Sa(a)+" -bars -bars-"+a.id}function de(a){return Sa(a.data)+" -arc -arc-"+a.data.id} |
||||
function ee(a){return Sa(a)+" -area -area-"+a.id}function fe(a,b){return"-shape -shape-"+b+" -circle -circle-"+b}function Nc(a,b){return"-shape -shape-"+b+" -bar -bar-"+b}function ge(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Oc(a,b){return"event-rect event-rect-"+b}function he(a){return z(a.value)?Pc(a)?0.5:1:0}function Ba(a){return a?m(a.x):null}function Ta(a){return m(E?ra(a.value):a.value)}function Ua(a){return A(a.value)}function Qc(a){return V(a.x)} |
||||
function Rc(a,b){var c,d=a[b].x,f=[];for(c=b-1;0<=c&&d===a[c].x;c--)f.push(a[c]);for(c=b;c<a.length&&d===a[c].x;c++)f.push(a[c]);return f}function Sc(a,b,c,d){c=c?c:0;d=d?d:a.length-1;var f=Math.floor((d-c)/2)+c;0<m(a[f].x)-b[0]?d=f:c=f;return 1===d-c?(f=[],a[c].x&&(f=f.concat(Rc(a,c))),a[d].x&&(f=f.concat(Rc(a,d))),Tc(f,b)):Sc(a,b,c,d)}function Uc(a,b){var c;c=a.map(function(a){return Sc(a.values,b)});return Tc(c,b)}function Tc(a,b){var c,d;a.forEach(function(a){var e=Ub(a,b);if(e<c||!c)c=e,d=a}); |
||||
return d}function Vc(a,b){var c,d,f,e,g;e=a.filter(function(a){return a&&z(a.value)});Wc&&0!==e.length&&(W.html(Xc(a)).style("visibility","hidden").style("display","block"),c=W.property("offsetWidth"),d=W.property("offsetHeight"),h?e=b[0]:(f=n.property("offsetLeft"),e=f+(cb?cb:db?1:40)+m(e[0].x)+20,g=e+c,f=f+(Ia?Ia:S())-(eb?eb:Cb?fb||h?1:40:1),g>f&&(e-=c+30)),c=b[1]+15+d<fa()?b[1]+15:b[1]-d,W.style("top",c+"px").style("left",e+"px").style("visibility","visible"))}function Yc(a){a=a.filter(function(a){return a&& |
||||
z(a.value)});Wc&&(ia(k.data.targets,"scatter")||F(k.data.targets)||l.selectAll("line.xgrid-focus").style("visibility","visible").data([a[0]]).attr(h?"y1":"x1",Ba).attr(h?"y2":"x2",Ba))}function Zc(){l.select("line.xgrid-focus").style("visibility","hidden")}function Ca(a){return a.x||0===a.x?m(a.x):null}function Da(a){return u(a.id)(a.value)}function ie(){var a={},b=0,c,d;nb(rb).forEach(function(f){for(c=0;c<v.length;c++)if(!(0>v[c].indexOf(f.id)))for(d=0;d<v[c].length;d++)if(v[c][d]in a){a[f.id]= |
||||
a[v[c][d]];break}x(a[f.id])&&(a[f.id]=b++)});a.__max__=b-1;return a}function je(a,b,c,d){var f=d?V:m;return b?function(d){var e=d.id in c?c[d.id]:0;return d.x||0===d.x?f(d.x)-a*(b/2-e):0}:function(){return 0}}function ke(a){return function(b){return(a?C(b.id):u(b.id))(b.value)}}function le(a,b){var c=Object.keys(a);return function(d,f){var e=b?C(d.id):u(d.id),g=e(0),h=g;nb(rb).forEach(function(b){b.id!==d.id&&a[b.id]===a[d.id]&&c.indexOf(b.id)<c.indexOf(d.id)&&0<b.values[f].value*d.value&&(h+=e(b.values[f].value)- |
||||
g)});return h}}function da(a,b){var c=x(a)?Ra():a;"string"===typeof c&&(c=[c]);for(var d=0;d<c.length;d++)Vb[c[d]]=b===B[c[d]],B[c[d]]=b}function ia(a,b){var c=!1;a.forEach(function(a){B[a.id]===b&&(c=!0);a.id in B||"line"!==b||(c=!0)});return c}function Va(a){return Vb[a.id]?1:0}function F(a){return ia(a,"pie")||ia(a,"donut")}function Wb(a){a="string"===typeof a?a:a.id;return!(a in B)||"line"===B[a]||"spline"===B[a]||"area"===B[a]||"area-spline"===B[a]}function $c(a){a="string"===typeof a?a:a.id; |
||||
return"spline"===B[a]||"area-spline"===B[a]}function rb(a){return"bar"===B["string"===typeof a?a:a.id]}function Pc(a){return"scatter"===B["string"===typeof a?a:a.id]}function ad(a){return"pie"===B["string"===typeof a?a:a.id]}function Qb(a){return"donut"===B["string"===typeof a?a:a.id]}function bd(a){return rb(a)?a.values:[]}function me(a){return Wb(a)||Pc(a)?a.values:[]}function ra(a){var b;if(!a)throw Error(a+" can not be parsed as d3.time with format "+Xb+". Maybe 'x' of this data is not defined. See data.x or data.xs option."); |
||||
b=e.time.format(Xb).parse(a);if(!b)throw Error("Failed to parse '"+a+"' with format "+Xb);return b}function cd(a,b){var c=e.mouse(a),d=e.select(a),f=1*d.attr("cx"),d=1*d.attr("cy");return Math.sqrt(Math.pow(f-c[0],2)+Math.pow(d-c[1],2))<b}function dd(a){var b=e.mouse(a),c=e.select(a);a=1*c.attr("x");var d=1*c.attr("y"),c=1*c.attr("width");return a-10<b[0]&&b[0]<a+c+10&&d-10<b[1]}function ne(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 Yd(a,b){var c=!1; |
||||
Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)});return c}function Ub(a,b){return Math.pow(m(a.x)-b[0],2)+Math.pow(A(a.value)-b[1],2)}function ed(a,b,c){oe(a,b);l.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",h?Da:Ca).attr("cy",h?Ca:Da).attr("stroke",function(){return P(b.id)}).attr("r",1.4*Wa).transition().duration(100).attr("r",Wa)}function Yb(a,b,c){pe(a,b); |
||||
l.select(".selected-circles-"+b.id).selectAll(".selected-circle-"+c).transition().duration(100).attr("r",0).remove()}function fd(a,b,c,d){a?ed(b,c,d):Yb(b,c,d)}function qe(){}function gd(){}function hd(a,b,c,d){}function Zb(a){return a.filter(function(a){return z(a.value)})}function $b(a,b){return(b?l.selectAll(".-circles-"+b):l).selectAll(".-circle"+(z(a)?"-"+a:""))}function ac(a){$b(a).filter(function(){return e.select(this).classed(ea)}).classed(ea,!1).attr("r",bc)}function re(a,b,c,d){var f,e, |
||||
g="M",k,l,m,id,n,ta=[];if(y(d))for(f=0;f<d.length;f++)ta[f]={},x(d[f].start)?ta[f].start=a[0].x:ta[f].start=E?ra(d[f].start):d[f].start,x(d[f].end)?ta[f].end=a[a.length-1].x:ta[f].end=E?ra(d[f].end):d[f].end;id=h?function(a){return c(a.value)}:function(a){return b(a.x)};n=h?function(a){return b(a.x)}:function(a){return c(a.value)};d=E?function(a,d,f,e){var g=a.x.getTime();a=d.x-a.x;d=new Date(g+a*(f+e));return"M"+b(new Date(g+a*f))+" "+c(l(f))+" "+b(d)+" "+c(l(f+e))}:function(a,d,f,e){return"M"+b(k(f))+ |
||||
" "+c(l(f))+" "+b(k(f+e))+" "+c(l(f+e))};for(f=0;f<a.length;f++)if(x(ta)||!ne(a[f].x,ta))g+=" "+id(a[f])+" "+n(a[f]);else{k=ha(a[f-1].x,a[f].x);l=J(a[f-1].value,a[f].value);e=b(a[f].x)-b(a[f-1].x);m=c(a[f].value)-c(a[f-1].value);e=Math.sqrt(Math.pow(e,2)+Math.pow(m,2));m=2/e;var p=2*m;for(e=m;1>=e;e+=p)g+=d(a[f-1],a[f],e,m)}return g}function cc(a){var b;sb=e.select(za);if(sb.empty())M.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); |
||||
else{sb.html("");k.data.x={};k.data.targets=Qa(a);xa();Z();m.domain(e.extent(ob(k.data.targets)));A.domain(mb("y"));ba.domain(mb("y2"));V.domain(m.domain());ib.domain(A.domain());jb.domain(ba.domain());aa=m.domain();K.scale(V);ua&&G.scale(m);n=e.select(za).append("svg").attr("width",r+D+$).attr("height",s+q+N).on("mouseenter",se).on("mouseleave",te);tb=n.append("defs");tb.append("clipPath").attr("id",dc).append("rect").attr("y",q).attr("width",r).attr("height",s-q);tb.append("clipPath").attr("id", |
||||
"xaxis-clip").append("rect").attr("x",-1-D).attr("y",-20).attr("width",X).attr("height",oa);tb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-D+1).attr("y",q-1).attr("width",zb).attr("height",xd);l=n.append("g").attr("transform",L.main);H=Ea?n.append("g").attr("transform",L.context):null;Fa=Ga?n.append("g").attr("transform",L.legend):null;W=e.select(za).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none");l.append("g").attr("class", |
||||
"x axis").attr("clip-path",h?"":"url("+document.URL+"#xaxis-clip)").attr("transform",L.x).call(h?La:O).append("text").attr("class","-axis-x-label").attr("x",r).attr("dy","-.5em").style("text-anchor","end").text(ue);l.append("g").attr("class","y axis").attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").call(h?O:La).append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(ve);Cb&&l.append("g").attr("class","y2 axis").attr("transform", |
||||
L.y2).call(Ob);a=l.append("g").attr("clip-path",Xa).attr("class","grid");jd&&a.append("g").attr("class","xgrids");ec&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(ec).enter().append("g").attr("class","xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",h?"":"rotate(-90)").attr("dx",h?0:-q).attr("dy",-5).text(function(a){return a.text})); |
||||
we&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",h?0:-10).attr("x2",h?r:-10).attr("y1",h?-10:q).attr("y2",h?-10:s);kd&&a.append("g").attr("class","ygrids");fc&&(a=a.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(fc).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform", |
||||
h?"rotate(-90)":"").attr("dx",h?0:-q).attr("dy",-5).text(function(a){return a.text}));l.append("g").attr("clip-path",Xa).attr("class","regions");l.append("g").attr("clip-path",Xa).attr("class","chart");l.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",ua?h?"ns-resize":"ew-resize":null);l.select(".chart").append("g").attr("class","chart-bars");l.select(".chart").append("g").attr("class","chart-lines");l.select(".chart").append("g").attr("class","chart-arcs").attr("transform", |
||||
M.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(we);if(ua)l.insert("rect",xe?null:"g.grid").attr("class","zoom-rect").attr("width",r).attr("height",s).style("opacity",0).style("cursor",h?"ns-resize":"ew-resize").call(G).on("dblclick.zoom",null);null!==ub&&L.extent("function"!==typeof ub?ub:ub(ob()));Ea&&(H.append("g").attr("clip-path",Xa).attr("class","chart"),H.select(".chart").append("g").attr("class","chart-bars"),H.select(".chart").append("g").attr("class", |
||||
"chart-lines"),H.append("g").attr("clip-path",Xa).attr("class","x brush").call(L).selectAll("rect").attr(h?"width":"height",h?Fb:fb),H.append("g").attr("class","x axis").attr("transform",M.subx).attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").call(La));Ga&&vb(k.data.targets);ld(k.data.targets);w({withTransform:!0,withUpdateXDomain:!0});if(ye){if(E&&"string"===typeof Ha){Ha=ra(Ha);for(a=0;a<k.data.targets[0].values.length&&0!==k.data.targets[0].values[a].x-Ha;a++);Ha=a}W.html(Xc(k.data.targets.map(function(a){return qb(a.values[Ha])}))); |
||||
W.style("top",md.top).style("left",md.left).style("display","block")}null==N.onresize&&(N.onresize=ze());N.onresize.add&&N.onresize.add(nd)}}function Ae(a){a.append("rect").attr("class",Oc).style("cursor",ma&&va?"pointer":null).on("mouseover",function(a,c){if(!Ya&&!F(k.data.targets)){var d=k.data.targets.map(function(a){return qb(a.values[c])}),f,e;if(0<Object.keys(Pa).length){e=[];for(var g in Pa)for(f=0;f<d.length;f++)if(d[f].id===g){e.push(d[f]);d.shift(f);break}d=e.concat(d)}hc&&ac(c,void 0).classed(fa, |
||||
!0).attr("r",ic);l.selectAll(".-bar"+(z(c)?"-"+c:"")).classed(fa,!1);Yc(d)}}).on("mouseout",function(a,c){F(k.data.targets)||(Zc(),W.style("display","none"),bc(c),l.selectAll(".-bar"+(z(void 0)?"-undefined":"")).classed(fa,!1))}).on("mousemove",function(a,c){var d;Ya||F(k.data.targets)||(d=k.data.targets.map(function(a){return qb(a.values[c])}),Vc(d,e.mouse(this)),ma&&(va||l.selectAll(".-shape-"+c).filter(function(a){return na(a)}).each(function(){var a=e.select(this).classed(fa,!0);"circle"===this.nodeName&& |
||||
a.attr("r",ic);n.select(".event-rect-"+c).style("cursor",null)}).filter(function(){var a=e.select(this);if("circle"===this.nodeName)return cd(this,Wa);if("rect"===this.nodeName)return dd(this,a.attr("x"),a.attr("y"))}).each(function(){var a=e.select(this);a.classed(fa)||(a.classed(fa,!0),"circle"===this.nodeName&&a.attr("r",Wa));n.select(".event-rect-"+c).style("cursor","pointer")})))}).on("click",function(a,c){F(k.data.targets)||(jc?jc=!1:l.selectAll(".-shape-"+c).each(function(a){od(this,a,c)}))}).call(e.behavior.drag().origin(Object).on("drag", |
||||
function(){pd(e.mouse(this))}).on("dragstart",function(){qd(e.mouse(this))}).on("dragend",function(){rd()})).call(G).on("dblclick.zoom",null)}function Be(a){a.append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",s).attr("class","event-rect").on("mouseout",function(){F(k.data.targets)||(Zc(),W.style("display","none"),bc())}).on("mousemove",function(){var a,c,d;Ya||F(k.data.targets)||(a=e.mouse(this),c=Uc(k.data.targets,a),d=[qb(c)],Vc(d,a),hc&&(bc(),ac(c.index,c.id).classed(fa,!0).attr("r", |
||||
ic)),Yc(d),100>Vb(c,a)?n.select(".event-rect").style("cursor","pointer"):n.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;F(k.data.targets)||(a=e.mouse(this),c=Uc(k.data.targets,a),100>Vb(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){od(this,c,c.index)}))}).call(e.behavior.drag().origin(Object).on("drag",function(){pd(e.mouse(this))}).on("dragstart",function(){qd(e.mouse(this))}).on("dragend",function(){rd()})).call(G).on("dblclick.zoom", |
||||
null)}function od(a,b,c){var d=e.select(a),f=d.classed(oa),g=!1,h;"circle"===a.nodeName?(g=cd(a,1.5*Wa),h=fd):"rect"===a.nodeName&&(g=dd(a),h=hd);if(va||g)ma&&na(b)&&(d.classed(oa,!f),h(!f,d,b,c)),Ce(b,d)}function pd(a){var b,c,d,f,g,h,m;F(k.data.targets)||!ma||ua&&!G.altDomain||(b=kc[0],c=kc[1],d=a[0],a=a[1],f=Math.min(b,d),g=Math.max(b,d),h=va?q:Math.min(c,a),m=va?s:Math.max(c,a),l.select(".dragarea").attr("x",f).attr("y",h).attr("width",g-f).attr("height",m-h),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return na(a)}).each(function(a, |
||||
b){var c=e.select(this),d=c.classed(oa),k=c.classed(lc),l,n,p,q;l=!1;"circle"===this.nodeName?(l=1*c.attr("cx"),n=1*c.attr("cy"),q=fd,l=f<l&&l<g&&h<n&&n<m):"rect"===this.nodeName&&(l=1*c.attr("x"),n=1*c.attr("y"),p=1*c.attr("width"),q=hd,l=f<l+p&&l<g&&n<m);l^k&&(c.classed(lc,!k),c.classed(oa,!d),q(!d,c,a,b))}))}function qd(a){!F(k.data.targets)&&ma&&(kc=a,l.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Ya=!0)}function rd(){!F(k.data.targets)&&ma&&(l.select(".dragarea").transition().duration(100).style("opacity", |
||||
0).remove(),l.selectAll(".-shape").classed(lc,!1),Ya=!1)}function w(a){var b,c,d,f;d=fe();var g,t,n,p=F(k.data.targets);a=y(a)?a:{};c=y(a.withY)?a.withY:!0;f=y(a.withSubchart)?a.withSubchart:!0;t=y(a.withTransition)?a.withTransition:!0;n=y(a.withTransform)?a.withTransform:!1;b=y(a.withUpdateXDomain)?a.withUpdateXDomain:!1;a=y(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1;t=t?De:0;a&&(m.domain(e.extent(ob(k.data.targets))),ba=m.domain(),G.scale(m).updateScaleExtent(),V.domain(m.domain()),L.scale(V)); |
||||
b&&(m.domain(L.empty()?ba:L.extent()),ua&&G.scale(m).updateScaleExtent());A.domain(mb("y"));ca.domain(mb("y2"));l.select(".x.axis").style("opacity",p?0:1).transition().duration(h?t:0).call(h?Aa:K);l.select(".y.axis").style("opacity",p?0:1).transition().duration(h?0:t).call(h?K:Aa);l.select(".y2.axis").style("opacity",p?0:1).transition().call(jb);l.select(".x.axis .-axis-x-label").attr("x",r);hb.domain(A.domain());ib.domain(ca.domain());W.style("display","none");l.select("line.xgrid-focus").style("visibility", |
||||
"hidden").attr("y2",s);if(jd){if("year"===Ee){b=[];var u=ob();a=u[0].getFullYear();for(u=u[1].getFullYear();a<=u;a++)b.push(new Date(a+"-01-01 00:00:00"))}else b=m.ticks(10);b=l.select(".xgrids").selectAll(".xgrid").data(b);b.enter().append("line").attr("class","xgrid");b.attr("x1",h?0:function(a){return m(a)-K.tickOffset()}).attr("x2",h?r:function(a){return m(a)-K.tickOffset()}).attr("y1",h?function(a){return m(a)-K.tickOffset()}:q).attr("y2",h?function(a){return m(a)-K.tickOffset()}:s).style("opacity", |
||||
function(){return+e.select(this).attr(h?"y1":"x1")===(h?s:0)?0:1});b.exit().remove()}fc&&(b=l.selectAll(".xgrid-lines"),b.selectAll("line").transition().duration(t).attr("x1",h?0:Ta).attr("x2",h?r:Ta).attr("y1",h?Ta:q).attr("y2",h?Ta:s),b.selectAll("text").attr("x",h?r:0).attr("y",Ta));c&&kd&&(b=l.select(".ygrids").selectAll(".ygrid").data(A.ticks(10)),b.enter().append("line").attr("class","ygrid"),b.attr("x1",h?A:0).attr("x2",h?A:r).attr("y1",h?0:A).attr("y2",h?s:A),b.exit().remove());c&&gc&&(c= |
||||
L.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(xe);if(ua)l.insert("rect",ye?null:"g.grid").attr("class","zoom-rect").attr("width",r).attr("height",s).style("opacity",0).style("cursor",h?"ns-resize":"ew-resize").call(G).on("dblclick.zoom",null);null!==ub&&K.extent("function"!==typeof ub?ub:ub(ob()));Ea&&(H.append("g").attr("clip-path",Xa).attr("class","chart"),H.select(".chart").append("g").attr("class","chart-bars"),H.select(".chart").append("g").attr("class", |
||||
"chart-lines"),H.append("g").attr("clip-path",Xa).attr("class","x brush").call(K).selectAll("rect").attr(h?"width":"height",h?Db:gb),H.append("g").attr("class","x axis").attr("transform",L.subx).attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").call(hb));Ga&&vb(k.data.targets);ld(k.data.targets);w({withTransform:!0,withUpdateXDomain:!0});if(ze){if(E&&"string"===typeof Ha){Ha=ra(Ha);for(a=0;a<k.data.targets[0].values.length&&0!==k.data.targets[0].values[a].x-Ha;a++);Ha=a}W.html(Xc(k.data.targets.map(function(a){return qb(a.values[Ha])}))); |
||||
W.style("top",md.top).style("left",md.left).style("display","block")}null==M.onresize&&(M.onresize=Ae());M.onresize.add&&M.onresize.add(nd)}}function Be(a){a.append("rect").attr("class",Oc).style("cursor",la&&va?"pointer":null).on("mouseover",function(a,c){if(!Ya&&!F(k.data.targets)){var d=k.data.targets.map(function(a){return qb(a.values[c])}),f,e;if(0<Object.keys(Pa).length){e=[];for(var g in Pa)for(f=0;f<d.length;f++)if(d[f].id===g){e.push(d[f]);d.shift(f);break}d=e.concat(d)}gc&&$b(c,void 0).classed(ea, |
||||
!0).attr("r",hc);l.selectAll(".-bar"+(z(c)?"-"+c:"")).classed(ea,!1);Yc(d)}}).on("mouseout",function(a,c){F(k.data.targets)||(Zc(),W.style("display","none"),ac(c),l.selectAll(".-bar"+(z(void 0)?"-undefined":"")).classed(ea,!1))}).on("mousemove",function(a,c){var d;Ya||F(k.data.targets)||(d=k.data.targets.map(function(a){return qb(a.values[c])}),Vc(d,e.mouse(this)),la&&(va||l.selectAll(".-shape-"+c).filter(function(a){return ma(a)}).each(function(){var a=e.select(this).classed(ea,!0);"circle"===this.nodeName&& |
||||
a.attr("r",hc);n.select(".event-rect-"+c).style("cursor",null)}).filter(function(){var a=e.select(this);if("circle"===this.nodeName)return cd(this,Wa);if("rect"===this.nodeName)return dd(this,a.attr("x"),a.attr("y"))}).each(function(){var a=e.select(this);a.classed(ea)||(a.classed(ea,!0),"circle"===this.nodeName&&a.attr("r",Wa));n.select(".event-rect-"+c).style("cursor","pointer")})))}).on("click",function(a,c){F(k.data.targets)||(ic?ic=!1:l.selectAll(".-shape-"+c).each(function(a){od(this,a,c)}))}).call(e.behavior.drag().origin(Object).on("drag", |
||||
function(){pd(e.mouse(this))}).on("dragstart",function(){qd(e.mouse(this))}).on("dragend",function(){rd()})).call(G).on("dblclick.zoom",null)}function Ce(a){a.append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",s).attr("class","event-rect").on("mouseout",function(){F(k.data.targets)||(Zc(),W.style("display","none"),ac())}).on("mousemove",function(){var a,c,d;Ya||F(k.data.targets)||(a=e.mouse(this),c=Uc(k.data.targets,a),d=[qb(c)],Vc(d,a),gc&&(ac(),$b(c.index,c.id).classed(ea,!0).attr("r", |
||||
hc)),Yc(d),100>Ub(c,a)?n.select(".event-rect").style("cursor","pointer"):n.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;F(k.data.targets)||(a=e.mouse(this),c=Uc(k.data.targets,a),100>Ub(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){od(this,c,c.index)}))}).call(e.behavior.drag().origin(Object).on("drag",function(){pd(e.mouse(this))}).on("dragstart",function(){qd(e.mouse(this))}).on("dragend",function(){rd()})).call(G).on("dblclick.zoom", |
||||
null)}function od(a,b,c){var d=e.select(a),f=d.classed(na),g=!1,h;"circle"===a.nodeName?(g=cd(a,1.5*Wa),h=fd):"rect"===a.nodeName&&(g=dd(a),h=hd);if(va||g)la&&ma(b)&&(d.classed(na,!f),h(!f,d,b,c)),De(b,d)}function pd(a){var b,c,d,f,g,h,m;F(k.data.targets)||!la||ua&&!G.altDomain||(b=jc[0],c=jc[1],d=a[0],a=a[1],f=Math.min(b,d),g=Math.max(b,d),h=va?q:Math.min(c,a),m=va?s:Math.max(c,a),l.select(".dragarea").attr("x",f).attr("y",h).attr("width",g-f).attr("height",m-h),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return ma(a)}).each(function(a, |
||||
b){var c=e.select(this),d=c.classed(na),k=c.classed(kc),l,n,p,q;l=!1;"circle"===this.nodeName?(l=1*c.attr("cx"),n=1*c.attr("cy"),q=fd,l=f<l&&l<g&&h<n&&n<m):"rect"===this.nodeName&&(l=1*c.attr("x"),n=1*c.attr("y"),p=1*c.attr("width"),q=hd,l=f<l+p&&l<g&&n<m);l^k&&(c.classed(kc,!k),c.classed(na,!d),q(!d,c,a,b))}))}function qd(a){!F(k.data.targets)&&la&&(jc=a,l.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Ya=!0)}function rd(){!F(k.data.targets)&&la&&(l.select(".dragarea").transition().duration(100).style("opacity", |
||||
0).remove(),l.selectAll(".-shape").classed(kc,!1),Ya=!1)}function w(a){var b,c,d,f;d=ie();var g,t,n,p=F(k.data.targets);a=y(a)?a:{};c=y(a.withY)?a.withY:!0;f=y(a.withSubchart)?a.withSubchart:!0;t=y(a.withTransition)?a.withTransition:!0;n=y(a.withTransform)?a.withTransform:!1;b=y(a.withUpdateXDomain)?a.withUpdateXDomain:!1;a=y(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1;t=t?Ee:0;a&&(m.domain(e.extent(ob(k.data.targets))),aa=m.domain(),G.scale(m).updateScaleExtent(),V.domain(m.domain()),K.scale(V)); |
||||
b&&(m.domain(K.empty()?aa:K.extent()),ua&&G.scale(m).updateScaleExtent());A.domain(mb("y"));ba.domain(mb("y2"));l.select(".x.axis").style("opacity",p?0:1).transition().duration(h?t:0).call(h?La:O);l.select(".y.axis").style("opacity",p?0:1).transition().duration(h?0:t).call(h?O:La);l.select(".y2.axis").style("opacity",p?0:1).transition().call(Ob);l.select(".x.axis .-axis-x-label").attr("x",r);ib.domain(A.domain());jb.domain(ba.domain());W.style("display","none");l.select("line.xgrid-focus").style("visibility", |
||||
"hidden").attr("y2",s);if(jd){if("year"===Fe){b=[];var u=ob();a=u[0].getFullYear();for(u=u[1].getFullYear();a<=u;a++)b.push(new Date(a+"-01-01 00:00:00"))}else b=m.ticks(10);b=l.select(".xgrids").selectAll(".xgrid").data(b);b.enter().append("line").attr("class","xgrid");b.attr("x1",h?0:function(a){return m(a)-O.tickOffset()}).attr("x2",h?r:function(a){return m(a)-O.tickOffset()}).attr("y1",h?function(a){return m(a)-O.tickOffset()}:q).attr("y2",h?function(a){return m(a)-O.tickOffset()}:s).style("opacity", |
||||
function(){return+e.select(this).attr(h?"y1":"x1")===(h?s:0)?0:1});b.exit().remove()}ec&&(b=l.selectAll(".xgrid-lines"),b.selectAll("line").transition().duration(t).attr("x1",h?0:Ta).attr("x2",h?r:Ta).attr("y1",h?Ta:q).attr("y2",h?Ta:s),b.selectAll("text").attr("x",h?r:0).attr("y",Ta));c&&kd&&(b=l.select(".ygrids").selectAll(".ygrid").data(A.ticks(10)),b.enter().append("line").attr("class","ygrid"),b.attr("x1",h?A:0).attr("x2",h?A:r).attr("y1",h?0:A).attr("y2",h?s:A),b.exit().remove());c&&fc&&(c= |
||||
l.select(".ygrid-lines"),c.selectAll("line").transition().duration(t).attr("x1",h?Ua:0).attr("x2",h?Ua:r).attr("y1",h?0:Ua).attr("y2",h?s:Ua),c.selectAll("text").attr("x",h?0:r).attr("y",Ua));c=l.selectAll(".-bars").selectAll(".-bar").data(bd);c.enter().append("path").attr("d",wb(d,!1)).style("stroke","none").style("opacity",0).style("fill",function(a){return P(a.id)}).attr("class",Nc);c.style("opacity",Va).transition().duration(t).attr("d",wb(d,!1)).style("opacity",1);c.exit().transition().duration(t).style("opacity", |
||||
0).remove();l.selectAll(".-line").style("opacity",Va).transition().duration(t).attr("d",Fe).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(t).attr("d",Ge).style("opacity",sd);c=l.selectAll(".-circles").selectAll(".-circle").data(je);c.enter().append("circle").attr("class",ce).style("opacity",0).attr("r",cc);c.style("opacity",Va).transition().duration(t).style("opacity",ee).attr("cx",h?Da:Ca).attr("cy",h?Ca:Da);c.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform", |
||||
n?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(t).attrTween("d",function(a){a=$(a);if(!a)return function(){return"M 0 0"};var b=e.interpolate(this._current,a);this._current=b(0);return function(a){a=b(a);return ad(a.data)||Rb(a.data)?kb(a,!0):"M 0 0"}}).attr("transform",n?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",Ab).style("opacity",0).transition().duration(t).text(yd).style("opacity",function(a){return ad(a.data)|| |
||||
Rb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",ja(k.data.targets,"donut")?1:0);Ea&&(null!==e.event&&"zoom"===e.event.type&&L.extent(m.orgDomain()).update(),f&&(H.select(".x.axis").style("opacity",p?0:1).transition().duration(h?t:0).call(La),L.empty()||L.extent(m.orgDomain()).update(),f=H.selectAll(".-bars").selectAll(".-bar").data(bd),f.enter().append("path").attr("d",wb(d)).style("stroke","none").style("fill",function(a){return P(a.id)}).attr("class",Nc),f.style("opacity",Va).transition().duration(t).attr("d", |
||||
wb(d)).style("opacity",1),f.exit().transition().duration(t).style("opacity",0).remove(),H.selectAll(".-line").style("opacity",Va).transition().duration(t).attr("d",He).style("opacity",1)));l.selectAll(".selected-circles").filter(function(a){return rb(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(t).attr("cx",h?Da:Ca).attr("cy",h?Ca:Da);da?(f=l.select(".event-rects").selectAll(".event-rect").data([0]),Be(f.enter()),f.attr("x",0).attr("y",0).attr("width",r).attr("height", |
||||
s)):(Ub?(g=function(a,b){var c=Ic(b),d=b<gb()-1?k.data.targets[0].values[b+1].x:void 0;return(m(d?d:a.x+50)-m(c?c:a.x-50))/2},d=function(a,b){var c=Ic(b);return(m(a.x)+m(c?c:a.x-50))/2}):(g=Y(),d=function(a){return m(a.x)-g/2}),f=Zd(),l.select(".event-rects").datum(f?f.values:[]),f=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Ae(f.enter()),f.attr("class",Oc).attr("x",h?0:d).attr("y",h?d:0).attr("width",h?r:g).attr("height",h?g:s),f.exit().remove());d=l.select(".regions").selectAll("rect.region").data(Q); |
||||
d.enter().append("rect").style("fill-opacity",0);d.attr("class",de).attr("x",h?0:Tb).attr("y",h?Tb:q).attr("width",h?r:Dc).attr("height",h?Dc:s).transition().duration(t).style("fill-opacity",function(a){return z(a.opacity)?a.opacity:0.1});d.exit().transition().duration(t).style("fill-opacity",0).remove();Ra().forEach(function(a){Wb[a]=!0})}function Ie(){"mousemove"===e.event.sourceEvent.type&&G.altDomain?(m.domain(G.altDomain),G.scale(m).updateScaleExtent()):(ka&&m.orgDomain()[0]===ba[0]&&m.domain([ba[0]- |
||||
1E-10,m.orgDomain()[1]]),w({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===e.event.sourceEvent.type&&(jc=!0))}function ze(){function a(){b.forEach(function(a){a()})}var b=[];a.add=function(a){b.push(a)};return a}function nd(){wa();Z();L.scale(V);ua&&G.scale(m);n.attr("width",Cb).attr("height",xa);n.select("#"+ec).select("rect").attr("width",r).attr("height",s);n.select("#xaxis-clip").select("rect").attr("width",X);n.select(".zoom-rect").attr("width",r).attr("height",s);l.select(".x.axis").attr("transform", |
||||
M.x);l.select(".y2.axis").attr("transform",M.y2);l.select(".chart-arcs").attr("transform",M.arc);Ea&&(H.attr("transform",M.context),H.select(".x.axis").attr("transform",M.subx));Ga&&(Fa.attr("transform",M.legend),vb(k.data.targets,{withTransition:!1}));w({withTransition:!1,withUpdateXDomain:!0})}function ld(a){var b;l.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").append("g").attr("class", |
||||
Mc).style("fill",function(a){return P(a.id)}).style("stroke","none").style("cursor",function(a){return na(a)?"pointer":null});b=l.select(".chart-lines").selectAll(".chart-line").data(a).enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none");b.append("path").attr("class",Lc).style("opacity",0).style("stroke",function(a){return P(a.id)});b.append("path").attr("class",be).style("opacity",function(){sd=+e.select(this).style("opacity");return 0}).style("fill", |
||||
function(a){return P(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",$d).style("fill",function(a){return P(a.id)}).style("cursor",function(a){return na(a)?"pointer":null});a.forEach(function(a){var b=xb(a.id);l.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Qb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+ |
||||
a.data.id});b.append("path").attr("class",ae).style("opacity",0).style("fill",function(a){return P(a.data.id)}).style("cursor",function(a){return na(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){zc(a.data.id);mc(a.data.id)}).on("mouseout",function(a){Sb(a.data.id);nc()});b.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none");Ea&&(b=H.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class", |
||||
0).remove();l.selectAll(".-line").style("opacity",Va).transition().duration(t).attr("d",Ge).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(t).attr("d",He).style("opacity",sd);c=l.selectAll(".-circles").selectAll(".-circle").data(me);c.enter().append("circle").attr("class",fe).style("opacity",0).attr("r",bc);c.style("opacity",Va).transition().duration(t).style("opacity",he).attr("cx",h?Da:Ca).attr("cy",h?Ca:Da);c.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform", |
||||
n?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(t).attrTween("d",function(a){a=pa(a);if(!a)return function(){return"M 0 0"};var b=e.interpolate(this._current,a);this._current=b(0);return function(a){a=b(a);return ad(a.data)||Qb(a.data)?kb(a,!0):"M 0 0"}}).attr("transform",n?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",yd).style("opacity",0).transition().duration(t).text(Jd).style("opacity",function(a){return ad(a.data)|| |
||||
Qb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",ia(k.data.targets,"donut")?1:0);Ea&&(null!==e.event&&"zoom"===e.event.type&&K.extent(m.orgDomain()).update(),f&&(H.select(".x.axis").style("opacity",p?0:1).transition().duration(h?t:0).call(hb),K.empty()||K.extent(m.orgDomain()).update(),f=H.selectAll(".-bars").selectAll(".-bar").data(bd),f.enter().append("path").attr("d",wb(d)).style("stroke","none").style("fill",function(a){return P(a.id)}).attr("class",Nc),f.style("opacity",Va).transition().duration(t).attr("d", |
||||
wb(d)).style("opacity",1),f.exit().transition().duration(t).style("opacity",0).remove(),H.selectAll(".-line").style("opacity",Va).transition().duration(t).attr("d",Ie).style("opacity",1)));l.selectAll(".selected-circles").filter(function(a){return rb(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(t).attr("cx",h?Da:Ca).attr("cy",h?Ca:Da);ca?(f=l.select(".event-rects").selectAll(".event-rect").data([0]),Ce(f.enter()),f.attr("x",0).attr("y",0).attr("width",r).attr("height", |
||||
s)):(Tb?(g=function(a,b){var c=Ic(b),d=b<Ka()-1?k.data.targets[0].values[b+1].x:void 0;return(m(d?d:a.x+50)-m(c?c:a.x-50))/2},d=function(a,b){var c=Ic(b);return(m(a.x)+m(c?c:a.x-50))/2}):(g=Y(),d=function(a){return m(a.x)-g/2}),f=be(),l.select(".event-rects").datum(f?f.values:[]),f=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Be(f.enter()),f.attr("class",Oc).attr("x",h?0:d).attr("y",h?d:0).attr("width",h?r:g).attr("height",h?g:s),f.exit().remove());d=l.select(".regions").selectAll("rect.region").data(Q); |
||||
d.enter().append("rect").style("fill-opacity",0);d.attr("class",ge).attr("x",h?0:Sb).attr("y",h?Sb:q).attr("width",h?r:Dc).attr("height",h?Dc:s).transition().duration(t).style("fill-opacity",function(a){return z(a.opacity)?a.opacity:0.1});d.exit().transition().duration(t).style("fill-opacity",0).remove();Ra().forEach(function(a){Vb[a]=!0})}function Je(){"mousemove"===e.event.sourceEvent.type&&G.altDomain?(m.domain(G.altDomain),G.scale(m).updateScaleExtent()):(ja&&m.orgDomain()[0]===aa[0]&&m.domain([aa[0]- |
||||
1E-10,m.orgDomain()[1]]),w({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===e.event.sourceEvent.type&&(ic=!0))}function Ae(){function a(){b.forEach(function(a){a()})}var b=[];a.add=function(a){b.push(a)};return a}function nd(){xa();Z();K.scale(V);ua&&G.scale(m);n.attr("width",Ab).attr("height",ya);n.select("#"+dc).select("rect").attr("width",r).attr("height",s);n.select("#xaxis-clip").select("rect").attr("width",X);n.select(".zoom-rect").attr("width",r).attr("height",s);l.select(".x.axis").attr("transform", |
||||
L.x);l.select(".y2.axis").attr("transform",L.y2);l.select(".chart-arcs").attr("transform",L.arc);Ea&&(H.attr("transform",L.context),H.select(".x.axis").attr("transform",L.subx));Ga&&(Fa.attr("transform",L.legend),vb(k.data.targets,{withTransition:!1}));w({withTransition:!1,withUpdateXDomain:!0})}function ld(a){var b;l.select(".chart-bars").selectAll(".chart-bar").data(a).enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none").append("g").attr("class", |
||||
Mc).style("fill",function(a){return P(a.id)}).style("stroke","none").style("cursor",function(a){return ma(a)?"pointer":null});b=l.select(".chart-lines").selectAll(".chart-line").data(a).enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none");b.append("path").attr("class",Lc).style("opacity",0).style("stroke",function(a){return P(a.id)});b.append("path").attr("class",ee).style("opacity",function(){sd=+e.select(this).style("opacity");return 0}).style("fill", |
||||
function(a){return P(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",ce).style("fill",function(a){return P(a.id)}).style("cursor",function(a){return ma(a)?"pointer":null});a.forEach(function(a){var b=xb(a.id);l.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Pb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+ |
||||
a.data.id});b.append("path").attr("class",de).style("opacity",0).style("fill",function(a){return P(a.data.id)}).style("cursor",function(a){return ma(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){zc(a.data.id);lc(a.data.id)}).on("mouseout",function(a){Rb(a.data.id);mc()});b.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none");Ea&&(b=H.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class", |
||||
function(a){return"chart-bar target target-"+a.id}),b.append("g").attr("class",Mc).style("fill",function(a){return P(a.id)}),b=H.select(".chart-lines").selectAll(".chart-line").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}),b.append("path").attr("class",Lc).style("opacity",0).style("stroke",function(a){return P(a.id)}));Ga&&vb(a);n.selectAll(".target").transition().style("opacity",1)}function Za(a,b){k.data.targets.forEach(function(b){for(var d=0;d< |
||||
a.length;d++)if(b.id===a[d].id){b.values=a[d].values;a.splice(d,1);break}});k.data.targets=k.data.targets.concat(a);ld(k.data.targets);w({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});b()}function mc(a){var b=n.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",0.3);b.filter(c).transition().duration(100).style("opacity",1)}function Je(a){var b=n.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity", |
||||
1);b.filter(c).transition().duration(100).style("opacity",0.3)}function nc(){n.selectAll(".legend-item").transition().duration(100).style("opacity",1)}function vb(a,b){var c=Ra(a),d,e=r/2-$a*Object.keys(a).length/2,g;b=x(b)?{}:b;g=y(b.withTransition)?b.withTransition:!0;d=Fa.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Ke(a)}).on("mouseover",function(a){mc(a);k.focus(a)}).on("mouseout", |
||||
function(){nc();k.revert()});d.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return qa/2-16}).attr("width",$a).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return P(a)}).attr("x",-200).attr("y",function(){return qa/2-9}).attr("width",10).attr("height",10);d.append("text").text(function(a){return y(Pa[a])?Pa[a]:a}).style("pointer-events","none").attr("x",-200).attr("y", |
||||
function(){return qa/2});Fa.selectAll("rect.legend-item-event").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+$a*b});Fa.selectAll("rect.legend-item-tile").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+$a*b});Fa.selectAll("text").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+$a*b+14})}function xb(a){return a?"-"+a.replace(/\./g,"\\."):""}function la(a){return".target"+xb(a)}function oc(a){return Jc(a.id)}function pc(a){return"data"in |
||||
a&&Jc(a.data.id)}var k={data:{}},pb={},fa="_expanded_",oa="_selected_",lc="_included_",ya=g(["bindto"],"#chart"),Ja=g(["size","width"],null),Ib=g(["size","height"],null),bb=g(["padding","left"],null),db=g(["padding","right"],null),ua=g(["zoom","enabled"],!1),td=g(["zoom","extent"],null),xe=g(["zoom","privileged"],!1),re=g(["onenter"],function(){}),se=g(["onleave"],function(){}),De=g(["transition","duration"],350);if(!("data"in R))throw Error("data is required in config");var sa=g(["data","x"],null), |
||||
da=g(["data","xs"],null),Yb=g(["data","x_format"],"%Y-%m-%d"),Yd=g(["data","id_converter"],function(a){return a}),Pa=g(["data","names"],{}),v=g(["data","groups"],[]),yc=g(["data","axes"],{}),Hc=g(["data","type"],null),B=g(["data","types"],{}),ud=g(["data","regions"],{}),Le=g(["data","colors"],{}),ma=g(["data","selection","enabled"],!1),va=g(["data","selection","grouped"],!1),na=g(["data","selection","isselectable"],function(){return!0}),Ea=g(["subchart","show"],!1),Db=Ea?g(["subchart","size","height"], |
||||
60):0,Me=g(["color","pattern"],null),Ga=g(["legend","show"],!0),$a=g(["legend","item","width"],80),Ke=g(["legend","item","onclick"],function(){}),vd=g(["axis","x","type"],"indexed"),Ma=g(["axis","x","categories"],[]),Ed=g(["axis","x","tick","centered"],!1),lb=g(["axis","x","tick","format"],null),ub=g(["axis","x","default"],null),te=g(["axis","x","label"],null),Od=g(["axis","y","max"],null),Md=g(["axis","y","min"],null),Qd=g(["axis","y","center"],null),ue=g(["axis","y","label"],null),cb=g(["axis", |
||||
"y","inner"],!1),Pb=g(["axis","y","tick","format"],null),Na=g(["axis","y","padding"],null),pe=g(["axis","y","ticks"],10),Eb=g(["axis","y2","show"],!1),Nd=g(["axis","y2","max"],null),Ld=g(["axis","y2","min"],null),Pd=g(["axis","y2","center"],null),eb=g(["axis","y2","inner"],!1),Cd=g(["axis","y2","tick","format"],null),Oa=g(["axis","y2","padding"],null),qe=g(["axis","y2","ticks"],10),h=g(["axis","rotated"],!1),jd=g(["grid","x","show"],!1),Ee=g(["grid","x","type"],"tick"),fc=g(["grid","x","lines"],null), |
||||
kd=g(["grid","y","show"],!1),gc=g(["grid","y","lines"],null),cc=g(["point","show"],!0)?g(["point","r"],2.5):0,ve=g(["point","focus","line","enabled"],!0),hc=g(["point","focus","expand","enabled"],!0),ic=g(["point","focus","expand","r"],hc?4:cc),Wa=g(["point","focus","select","r"],8),Ce=g(["point","onclick"],function(){}),le=g(["point","onselected"],function(){}),me=g(["point","onunselected"],function(){}),Hd=g(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),we=g(["arc","title"], |
||||
""),Q=g(["regions"],[]),Wc=g(["tooltip","enabled"],!0),Xc=g(["tooltip","contents"],function(a){var b=Pb?Pb:function(a){return+a},c=zb(),d,e,g,h;for(e=0;e<a.length;e++)a[e]&&z(a[e].value)&&(d||(d=c?c(a[e].x):a[e].x,d="<table class='-tooltip'><tr><th colspan='2'>"+d+"</th></tr>"),h=a[e].name,g=b(a[e].value),d+="<tr class='-tooltip-name-"+a[e].id+"'><td class='name'><span style='background-color:"+P(a[e].id)+"'></span>"+h+"</td><td class='value'>"+g+"</td></tr>");return d+"</table>"}),ye=g(["tooltip", |
||||
"init","show"],!1),Ha=g(["tooltip","init","x"],0),md=g(["tooltip","init","position"],{top:"0px",left:"50px"}),ec=ya.replace("#","")+"-clip",Xa="url("+document.URL+"#"+ec+")",E="timeseries"===vd,ka="categorized"===vd,Ub=!E&&(sa||da),kc=null,Ya=!1,jc=!1,qa=Ga?40:0,P=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(Le, |
||||
Me),Fd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}],[e.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)}}(),r,Fb,s,fb,Cb,xa,Ka,Gb,Hb,kb,wc,xc,Qb,Jb,Kb,Lb,Mb,Nb,Ob,m,A,ca,V,hb,ib,K,Aa,jb,La,zd=h?"left":"bottom",Ad=h?cb?"top":"bottom":cb?"right":"left",Bd=h?eb?"bottom":"top":eb?"left":"right",Dd=h?"left":"bottom",M={main:function(){return"translate("+D+","+q+")"},context:function(){return"translate("+sc+","+yb+")"},legend:function(){return"translate("+rc+","+qc+")"},y2:function(){return"translate("+(h?0:r)+","+(h?10:0)+")"}, |
||||
x:function(){return"translate(0,"+s+")"},subx:function(){return"translate(0,"+(h?0:fb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},vc=40,uc=20;Qb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var Fe=function(){var a=e.svg.line().x(h?function(a){return u(a.id)(a.value)}:Ba).y(h?Ba:function(a){return u(a.id)(a.value)});return function(b){var c=$b(b.values),d;if(Xb(b))return $c(b)?a.interpolate("cardinal"):a.interpolate("linear"),ud[b.id]?oe(c, |
||||
m,u(b.id),ud[b.id]):a(c);d=m(c[0].x);b=u(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Ge=function(){var a;a=h?e.svg.area().x0(function(a){return u(a.id)(0)}).x1(function(a){return u(a.id)(a.value)}).y(Ba):e.svg.area().x(Ba).y0(function(a){return u(a.id)(0)}).y1(function(a){return u(a.id)(a.value)});return function(b){var c=$b(b.values),d;if(ja([b],"area")||ja([b],"area-spline"))return $c(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=u(b.id)(c[0].value);return h? |
||||
"M "+b+" "+d:"M "+d+" "+b}}(),wb=function(a,b){var c=a.__max__+1,d=1<arguments.length?b:!0,e=ka?c?1.2*K.tickOffset()/c:0:0.6*((h?s:r)*(d?1:za(ba)/za(m.domain()))/(gb()-1)),g=ge(e,c,a,!!d),k=he(!!d),l=ie(a,!!d),n=d?C:u;return function(a,b){var c=n(a.id)(0),d=l(a,b)||c,c=[[g(a),d],[g(a),k(a)-(c-d)],[g(a)+e,k(a)-(c-d)],[g(a)+e,d]],d=h?1:0,m=h?0:1;return"M "+c[0][d]+","+c[0][m]+" L"+c[1][d]+","+c[1][m]+" L"+c[2][d]+","+c[2][m]+" L"+c[3][d]+","+c[3][m]+" z"}},He=function(){var a=e.svg.line().x(h?function(a){return C(a.id)(a.value)}: |
||||
Qc).y(h?Qc:function(a){return C(a.id)(a.value)});return function(b){var c=$b(b.values);return Xb(b)?a(c):"M "+V(c[0].x)+" "+C(b.id)(c[0].value)}}(),L=e.svg.brush().on("brush",function(){w({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),G=e.behavior.zoom().on("zoomstart",function(){G.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",ua?Ie:null);L.update=function(){H&&H.select(".x.brush").call(this);return this};L.scale=function(a){return h?this.y(a):this.x(a)}; |
||||
G.scale=function(a){return h?this.y(a):this.x(a)};G.orgScaleExtent=function(){var a=td?td:[1,10];return[a[0],Math.max(gb()/a[1],a[1])]};G.updateScaleExtent=function(){var a=za(m.orgDomain())/za(ba),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var n,tb,l,H,Fa,W,sb,ba,sd,Wb={};k.focus=function(a){var b=n.selectAll(la(a)),c=b.filter(oc),b=b.filter(pc);k.revert();k.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity", |
||||
1);F(k.data.targets)&&zc(a,!0);mc(a)};k.defocus=function(a){var b=n.selectAll(la(a)),c=b.filter(oc),b=b.filter(pc);k.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);F(k.data.targets)&&Sb(a);Je(a)};k.revert=function(a){var b=n.selectAll(la(a)),c=b.filter(oc),b=b.filter(pc);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);F(k.data.targets)&&Sb(a);nc()}; |
||||
k.show=function(a){n.selectAll(la(a)).transition().style("opacity",1)};k.hide=function(a){n.selectAll(la(a)).transition().style("opacity",0)};k.unzoom=function(){L.clear().update();w({withUpdateXDomain:!0})};k.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&Xd(a.xs);"categories"in a&&ka&&(Ma=a.categories,K.categories(Ma));if("cacheIds"in a&&Td(a.cacheIds))Za(Ud(a.cacheIds),a.done);else if("data"in a)Za(Qa(a.data),a.done);else if("url"in a)e.csv(a.url,function(b,c){Za(Qa(c), |
||||
a.done)});else if("rows"in a)Za(Qa(Fc(a.rows)),a.done);else if("columns"in a)Za(Qa(Gc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};k.unload=function(a){k.data.targets=k.data.targets.filter(function(b){return b.id!==a});n.selectAll(la(a)).transition().style("opacity",0).remove();Ga&&(n.selectAll(".legend-item"+xb(a)).transition().style("opacity",0).remove(),vb(k.data.targets));0<k.data.targets.length&&w({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};k.selected=function(a){a= |
||||
xb(a);return e.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return e.select(this).classed(oa)}).map(function(a){return a.map(function(a){return a.__data__})}))};k.select=function(a,b,c){ma&&l.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var g="circle"===this.nodeName?ed:ne,h="circle"===this.nodeName?Zb:gd;0<=b.indexOf(f)?na(d)&&(va||x(a)||0<=a.indexOf(d.id))&&g(e.select(this).classed(oa,!0),d,f):y(c)&&c&&h(e.select(this).classed(oa,!1),d,f)})};k.unselect= |
||||
function(a,b){ma&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var f="circle"===this.nodeName?Zb:gd;(x(b)||0<=b.indexOf(d))&&na(c)&&(va||x(a)||0<=a.indexOf(c.id))&&f(e.select(this).classed(oa,!1),c,d)})};k.toLine=function(a){ea(a,"line");w()};k.toSpline=function(a){ea(a,"spline");w()};k.toBar=function(a){ea(a,"bar");w()};k.toScatter=function(a){ea(a,"scatter");w()};k.toArea=function(a){ea(a,"area");w()};k.toAreaSpline=function(a){ea(a,"area-spline");w()};k.toPie=function(a){ea(a, |
||||
"pie");U();ha();w({withTransform:!0})};k.toDonut=function(a){ea(a,"donut");U();ha();w({withTransform:!0})};k.groups=function(a){if(x(a))return v;v=a;w();return v};k.regions=function(a){if(x(a))return Q;Q=a;w();return Q};k.regions.add=function(a){if(x(a))return Q;Q=Q.concat(a);w();return Q};k.regions.remove=function(a,b){var c=[].concat(a);b=y(b)?b:{};c.forEach(function(a){var c=z(b.duration)?b.duration:0;n.selectAll("."+a).transition().duration(c).style("fill-opacity",0).remove();Q=Q.filter(function(b){return 0> |
||||
b.classes.indexOf(a)})});return Q};k.data.get=function(a){a=k.data.getAsTarget(a);return y(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=nb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};k.resize=function(a){Ja=a?a.width:null;Ib=a?a.height:null;nd()};k.destroy=function(){k.data.targets=void 0;k.data.x={};sb.html("");N.onresize=null};if("url"in R.data)e.csv(R.data.url,function(a,b){dc(b)});else if("rows"in R.data)dc(Fc(R.data.rows));else if("columns"in |
||||
R.data)dc(Gc(R.data.columns));else throw Error("url or rows or columns is required.");return k}})(window); |
||||
a.length;d++)if(b.id===a[d].id){b.values=a[d].values;a.splice(d,1);break}});k.data.targets=k.data.targets.concat(a);ld(k.data.targets);w({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});b()}function lc(a){var b=n.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",0.3);b.filter(c).transition().duration(100).style("opacity",1)}function Ke(a){var b=n.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity", |
||||
1);b.filter(c).transition().duration(100).style("opacity",0.3)}function mc(){n.selectAll(".legend-item").transition().duration(100).style("opacity",1)}function vb(a,b){var c=Ra(a),d,e=r/2-$a*Object.keys(a).length/2,g;b=x(b)?{}:b;g=y(b.withTransition)?b.withTransition:!0;d=Fa.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Le(a)}).on("mouseover",function(a){lc(a);k.focus(a)}).on("mouseout", |
||||
function(){mc();k.revert()});d.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return qa/2-16}).attr("width",$a).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return P(a)}).attr("x",-200).attr("y",function(){return qa/2-9}).attr("width",10).attr("height",10);d.append("text").text(function(a){return y(Pa[a])?Pa[a]:a}).style("pointer-events","none").attr("x",-200).attr("y", |
||||
function(){return qa/2});Fa.selectAll("rect.legend-item-event").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+$a*b});Fa.selectAll("rect.legend-item-tile").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+$a*b});Fa.selectAll("text").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+$a*b+14})}function xb(a){return a?"-"+a.replace(/\./g,"\\."):""}function ka(a){return".target"+xb(a)}function nc(a){return Jc(a.id)}function oc(a){return"data"in |
||||
a&&Jc(a.data.id)}var k={data:{}},pb={},ea="_expanded_",na="_selected_",kc="_included_",za=g(["bindto"],"#chart"),Ia=g(["size","width"],null),Gb=g(["size","height"],null),cb=g(["padding","left"],null),eb=g(["padding","right"],null),ua=g(["zoom","enabled"],!1),td=g(["zoom","extent"],null),ye=g(["zoom","privileged"],!1),se=g(["onenter"],function(){}),te=g(["onleave"],function(){}),Ee=g(["transition","duration"],350);if(!("data"in R))throw Error("data is required in config");var sa=g(["data","x"],null), |
||||
ca=g(["data","xs"],null),Xb=g(["data","x_format"],"%Y-%m-%d"),ae=g(["data","id_converter"],function(a){return a}),Pa=g(["data","names"],{}),v=g(["data","groups"],[]),yc=g(["data","axes"],{}),Hc=g(["data","type"],null),B=g(["data","types"],{}),ud=g(["data","regions"],{}),Me=g(["data","colors"],{}),la=g(["data","selection","enabled"],!1),va=g(["data","selection","grouped"],!1),ma=g(["data","selection","isselectable"],function(){return!0}),Ea=g(["subchart","show"],!1),Bb=Ea?g(["subchart","size","height"], |
||||
60):0,Ne=g(["color","pattern"],null),Ga=g(["legend","show"],!0),$a=g(["legend","item","width"],80),Le=g(["legend","item","onclick"],function(){}),vd=g(["axis","x","type"],"indexed"),Ma=g(["axis","x","categories"],[]),Gd=g(["axis","x","tick","centered"],!1),lb=g(["axis","x","tick","format"],null),ub=g(["axis","x","default"],null),ue=g(["axis","x","label"],null),Rd=g(["axis","y","max"],null),Pd=g(["axis","y","min"],null),Td=g(["axis","y","center"],null),ve=g(["axis","y","label"],null),db=g(["axis", |
||||
"y","inner"],!1),Nb=g(["axis","y","tick","format"],null),Na=g(["axis","y","padding"],null),Cd=g(["axis","y","ticks"],10),Cb=g(["axis","y2","show"],!1),Qd=g(["axis","y2","max"],null),Od=g(["axis","y2","min"],null),Sd=g(["axis","y2","center"],null),fb=g(["axis","y2","inner"],!1),Ed=g(["axis","y2","tick","format"],null),Oa=g(["axis","y2","padding"],null),Fd=g(["axis","y2","ticks"],10),h=g(["axis","rotated"],!1),jd=g(["grid","x","show"],!1),Fe=g(["grid","x","type"],"tick"),ec=g(["grid","x","lines"],null), |
||||
kd=g(["grid","y","show"],!1),fc=g(["grid","y","lines"],null),bc=g(["point","show"],!0)?g(["point","r"],2.5):0,we=g(["point","focus","line","enabled"],!0),gc=g(["point","focus","expand","enabled"],!0),hc=g(["point","focus","expand","r"],gc?4:bc),Wa=g(["point","focus","select","r"],8),De=g(["point","onclick"],function(){}),oe=g(["point","onselected"],function(){}),pe=g(["point","onunselected"],function(){}),Kd=g(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),xe=g(["arc","title"], |
||||
""),Q=g(["regions"],[]),Wc=g(["tooltip","enabled"],!0),Xc=g(["tooltip","contents"],function(a){var b=Nb?Nb:function(a){return+a},c=tc(),d,e,g,h;for(e=0;e<a.length;e++)a[e]&&z(a[e].value)&&(d||(d=c?c(a[e].x):a[e].x,d="<table class='-tooltip'><tr><th colspan='2'>"+d+"</th></tr>"),h=a[e].name,g=b(a[e].value),d+="<tr class='-tooltip-name-"+a[e].id+"'><td class='name'><span style='background-color:"+P(a[e].id)+"'></span>"+h+"</td><td class='value'>"+g+"</td></tr>");return d+"</table>"}),ze=g(["tooltip", |
||||
"init","show"],!1),Ha=g(["tooltip","init","x"],0),md=g(["tooltip","init","position"],{top:"0px",left:"50px"}),dc=za.replace("#","")+"-clip",Xa="url("+document.URL+"#"+dc+")",E="timeseries"===vd,ja="categorized"===vd,Tb=!E&&(sa||ca),jc=null,Ya=!1,ic=!1,qa=Ga?40:0,P=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(Me, |
||||
Ne),Hd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}],[e.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)}}(),r,Db,s,gb,Ab,ya,Ja,Eb,Fb,kb,wc,xc,Pb,Hb,Ib,Jb,Kb,Lb,Mb,m,A,ba,V,ib,jb,O,La,Ob,hb,zd=h?"left":"bottom",Bd=h?db?"top":"bottom":db?"right":"left",Dd=h?fb?"bottom":"top":fb?"left":"right",Ad=h?"left":"bottom",L={main:function(){return"translate("+D+","+q+")"},context:function(){return"translate("+rc+","+yb+")"},legend:function(){return"translate("+qc+","+pc+")"},y2:function(){return"translate("+(h?0:r)+","+(h?10:0)+")"}, |
||||
x:function(){return"translate(0,"+s+")"},subx:function(){return"translate(0,"+(h?0:gb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},vc=40,uc=20;Pb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var Ge=function(){var a=e.svg.line().x(h?function(a){return u(a.id)(a.value)}:Ba).y(h?Ba:function(a){return u(a.id)(a.value)});return function(b){var c=Zb(b.values),d;if(Wb(b))return $c(b)?a.interpolate("cardinal"):a.interpolate("linear"),ud[b.id]?re(c, |
||||
m,u(b.id),ud[b.id]):a(c);d=m(c[0].x);b=u(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),He=function(){var a;a=h?e.svg.area().x0(function(a){return u(a.id)(0)}).x1(function(a){return u(a.id)(a.value)}).y(Ba):e.svg.area().x(Ba).y0(function(a){return u(a.id)(0)}).y1(function(a){return u(a.id)(a.value)});return function(b){var c=Zb(b.values),d;if(ia([b],"area")||ia([b],"area-spline"))return $c(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=u(b.id)(c[0].value);return h? |
||||
"M "+b+" "+d:"M "+d+" "+b}}(),wb=function(a,b){var c=a.__max__+1,d=1<arguments.length?b:!0,e=ja?c?1.2*O.tickOffset()/c:0:0.6*((h?s:r)*(d?1:Aa(aa)/Aa(m.domain()))/(Ka()-1)),g=je(e,c,a,!!d),k=ke(!!d),l=le(a,!!d),n=d?C:u;return function(a,b){var c=n(a.id)(0),d=l(a,b)||c,c=[[g(a),d],[g(a),k(a)-(c-d)],[g(a)+e,k(a)-(c-d)],[g(a)+e,d]],d=h?1:0,m=h?0:1;return"M "+c[0][d]+","+c[0][m]+" L"+c[1][d]+","+c[1][m]+" L"+c[2][d]+","+c[2][m]+" L"+c[3][d]+","+c[3][m]+" z"}},Ie=function(){var a=e.svg.line().x(h?function(a){return C(a.id)(a.value)}: |
||||
Qc).y(h?Qc:function(a){return C(a.id)(a.value)});return function(b){var c=Zb(b.values);return Wb(b)?a(c):"M "+V(c[0].x)+" "+C(b.id)(c[0].value)}}(),K=e.svg.brush().on("brush",function(){w({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),G=e.behavior.zoom().on("zoomstart",function(){G.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",ua?Je:null);K.update=function(){H&&H.select(".x.brush").call(this);return this};K.scale=function(a){return h?this.y(a):this.x(a)}; |
||||
G.scale=function(a){return h?this.y(a):this.x(a)};G.orgScaleExtent=function(){var a=td?td:[1,10];return[a[0],Math.max(Ka()/a[1],a[1])]};G.updateScaleExtent=function(){var a=Aa(m.orgDomain())/Aa(aa),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var n,tb,l,H,Fa,W,sb,aa,sd,Vb={};k.focus=function(a){var b=n.selectAll(ka(a)),c=b.filter(nc),b=b.filter(oc);k.revert();k.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity", |
||||
1);F(k.data.targets)&&zc(a,!0);lc(a)};k.defocus=function(a){var b=n.selectAll(ka(a)),c=b.filter(nc),b=b.filter(oc);k.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);F(k.data.targets)&&Rb(a);Ke(a)};k.revert=function(a){var b=n.selectAll(ka(a)),c=b.filter(nc),b=b.filter(oc);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);F(k.data.targets)&&Rb(a);mc()}; |
||||
k.show=function(a){n.selectAll(ka(a)).transition().style("opacity",1)};k.hide=function(a){n.selectAll(ka(a)).transition().style("opacity",0)};k.unzoom=function(){K.clear().update();w({withUpdateXDomain:!0})};k.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&$d(a.xs);"categories"in a&&ja&&(Ma=a.categories,O.categories(Ma));if("cacheIds"in a&&Wd(a.cacheIds))Za(Xd(a.cacheIds),a.done);else if("data"in a)Za(Qa(a.data),a.done);else if("url"in a)e.csv(a.url,function(b,c){Za(Qa(c), |
||||
a.done)});else if("rows"in a)Za(Qa(Fc(a.rows)),a.done);else if("columns"in a)Za(Qa(Gc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};k.unload=function(a){k.data.targets=k.data.targets.filter(function(b){return b.id!==a});n.selectAll(ka(a)).transition().style("opacity",0).remove();Ga&&(n.selectAll(".legend-item"+xb(a)).transition().style("opacity",0).remove(),vb(k.data.targets));0<k.data.targets.length&&w({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};k.selected=function(a){a= |
||||
xb(a);return e.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return e.select(this).classed(na)}).map(function(a){return a.map(function(a){return a.__data__})}))};k.select=function(a,b,c){la&&l.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var g="circle"===this.nodeName?ed:qe,h="circle"===this.nodeName?Yb:gd;0<=b.indexOf(f)?ma(d)&&(va||x(a)||0<=a.indexOf(d.id))&&g(e.select(this).classed(na,!0),d,f):y(c)&&c&&h(e.select(this).classed(na,!1),d,f)})};k.unselect= |
||||
function(a,b){la&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var f="circle"===this.nodeName?Yb:gd;(x(b)||0<=b.indexOf(d))&&ma(c)&&(va||x(a)||0<=a.indexOf(c.id))&&f(e.select(this).classed(na,!1),c,d)})};k.toLine=function(a){da(a,"line");w()};k.toSpline=function(a){da(a,"spline");w()};k.toBar=function(a){da(a,"bar");w()};k.toScatter=function(a){da(a,"scatter");w()};k.toArea=function(a){da(a,"area");w()};k.toAreaSpline=function(a){da(a,"area-spline");w()};k.toPie=function(a){da(a, |
||||
"pie");U();ga();w({withTransform:!0})};k.toDonut=function(a){da(a,"donut");U();ga();w({withTransform:!0})};k.groups=function(a){if(x(a))return v;v=a;w();return v};k.regions=function(a){if(x(a))return Q;Q=a;w();return Q};k.regions.add=function(a){if(x(a))return Q;Q=Q.concat(a);w();return Q};k.regions.remove=function(a,b){var c=[].concat(a);b=y(b)?b:{};c.forEach(function(a){var c=z(b.duration)?b.duration:0;n.selectAll("."+a).transition().duration(c).style("fill-opacity",0).remove();Q=Q.filter(function(b){return 0> |
||||
b.classes.indexOf(a)})});return Q};k.data.get=function(a){a=k.data.getAsTarget(a);return y(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=nb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};k.resize=function(a){Ia=a?a.width:null;Gb=a?a.height:null;nd()};k.destroy=function(){k.data.targets=void 0;k.data.x={};sb.html("");M.onresize=null};if("url"in R.data)e.csv(R.data.url,function(a,b){cc(b)});else if("rows"in R.data)cc(Fc(R.data.rows));else if("columns"in |
||||
R.data)cc(Gc(R.data.columns));else throw Error("url or rows or columns is required.");return k}})(window); |
||||
|
Loading…
Reference in new issue