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