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