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