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