Browse Source

Fix sacatter plot tooltip when same x data exists

pull/18/head
Masayuki Tanaka 11 years ago
parent
commit
31a2a1300f
  1. 70
      c3.js
  2. 146
      c3.min.js

70
c3.js

@ -628,50 +628,72 @@
return y(d.value); return y(d.value);
} }
function findSameXOfValues(values, index) {
var i, targetX = values[index].x, sames = [];
for (i = index - 1; i >= 0; i--) {
if (targetX !== values[i].x) { break; }
sames.push(values[i]);
}
for (i = index; i < values.length; i++) {
if (targetX !== values[i].x) { break; }
sames.push(values[i]);
}
return sames;
}
function findClosestOfValues(values, pos, _min, _max) { // MEMO: values must be sorted by x function findClosestOfValues(values, pos, _min, _max) { // MEMO: values must be sorted by x
var min = _min ? _min : 0, var min = _min ? _min : 0,
max = _max ? _max : values.length - 1, max = _max ? _max : values.length - 1,
med = Math.floor((max - min) / 2) + min, med = Math.floor((max - min) / 2) + min,
value = values[med], value = values[med],
diff = x(value.x) - pos[0], diff = x(value.x) - pos[0],
minDist, maxDist; candidates;
// Update rage for search // Update range for search
diff > 0 ? max = med : min = med; diff > 0 ? max = med : min = med;
// if candidates are two closest min and max, stop recursive call // if candidates are two closest min and max, stop recursive call
if ((max - min) === 1) { if ((max - min) === 1) {
if (! values[min].x) { return values[max]; }
if (! values[max].x) { return values[min]; } // Get candidates that has same min and max index
minDist = Math.pow(pos[0] - x(values[min].x), 2) + Math.pow(pos[1] - y(values[min].value), 2); candidates = [];
maxDist = Math.pow(pos[0] - x(values[max].x), 2) + Math.pow(pos[1] - y(values[max].value), 2); if (values[min].x) {
return minDist < maxDist ? values[min] : values[max]; candidates = candidates.concat(findSameXOfValues(values, min));
}
if (values[max].x) {
candidates = candidates.concat(findSameXOfValues(values, max));
}
// Determine the closest and return
return findClosest(candidates, pos);
} }
return findClosestOfValues(values, pos, min, max); return findClosestOfValues(values, pos, min, max);
} }
function findClosest(targets, mouse) { function findClosestFromTargets(targets, pos) {
var closest, closests, minDist; var candidates;
// map to array of closest points of each target // map to array of closest points of each target
closests = targets.map(function (target) { candidates = targets.map(function (target) {
return findClosestOfValues(target.values, mouse); return findClosestOfValues(target.values, pos);
}); });
// decide closest point // decide closest point and return
closests.forEach(function (c) { return findClosest(candidates, pos);
var dist = Math.pow(x(c.x) - mouse[0], 2) + Math.pow(y(c.value) - mouse[1], 2); }
if (dist < minDist || ! minDist) { function findClosest(values, pos) {
minDist = dist; var minDist, closest;
closest = c; values.forEach(function (v) {
var d = dist(v, pos);
if (d < minDist || ! minDist) {
minDist = d;
closest = v;
} }
}); });
// TODO: multiple closests when each is very close
return closest; return closest;
} }
//-- Tooltip --// //-- Tooltip --//
function showTooltip(selectedData, mouse) { function showTooltip(selectedData, mouse) {
@ -894,8 +916,8 @@
return found; return found;
} }
function dist(data, mouse) { function dist(data, pos) {
return Math.pow(x(data.x) - mouse[0], 2) + Math.pow(y(data.value) - mouse[1], 2); return Math.pow(x(data.x) - pos[0], 2) + Math.pow(y(data.value) - pos[1], 2);
} }
//-- Selection --// //-- Selection --//
@ -1480,7 +1502,7 @@
if (dragging) { return; } // do nothing when dragging if (dragging) { return; } // do nothing when dragging
mouse = d3.mouse(this); mouse = d3.mouse(this);
closest = findClosest(c3.data.targets, mouse); closest = findClosestFromTargets(c3.data.targets, mouse);
// show tooltip when cursor is close to some point // show tooltip when cursor is close to some point
selectedData = [addName(closest)]; selectedData = [addName(closest)];
@ -1504,7 +1526,7 @@
}) })
.on('click', function () { .on('click', function () {
var mouse = d3.mouse(this), var mouse = d3.mouse(this),
closest = findClosest(c3.data.targets, mouse); closest = findClosestFromTargets(c3.data.targets, mouse);
// select if selection enabled // select if selection enabled
if (dist(closest, mouse) < 100) { if (dist(closest, mouse) < 100) {

146
c3.min.js vendored

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

Loading…
Cancel
Save