Browse Source

Fix tooltip class

pull/1/head
Masayuki Tanaka 11 years ago
parent
commit
4c2099e8e9
  1. 12
      c3.css
  2. 2
      c3.js
  3. 114
      c3.min.js

12
c3.css

@ -90,7 +90,7 @@ text {
/*-- Tooltip --*/ /*-- Tooltip --*/
.tooltip { .-tooltip {
border-collapse:collapse; border-collapse:collapse;
border-spacing:0; border-spacing:0;
background-color:#fff; background-color:#fff;
@ -100,28 +100,28 @@ text {
box-shadow: 7px 7px 12px -9px rgba(119,119,119,10); box-shadow: 7px 7px 12px -9px rgba(119,119,119,10);
opacity: 0.9; opacity: 0.9;
} }
.tooltip tr { .-tooltip tr {
border:1px solid #CCC; border:1px solid #CCC;
} }
.tooltip th { .-tooltip th {
background-color: #aaa; background-color: #aaa;
font-size:14px; font-size:14px;
padding:2px 5px; padding:2px 5px;
text-align:left; text-align:left;
color:#FFF; color:#FFF;
} }
.tooltip td { .-tooltip td {
font-size:13px; font-size:13px;
padding: 3px 6px; padding: 3px 6px;
background-color:#fff; background-color:#fff;
border-left:1px dotted #999; border-left:1px dotted #999;
} }
.tooltip td > span { .-tooltip td > span {
display: inline-block; display: inline-block;
width: 10px; width: 10px;
height: 10px; height: 10px;
margin-right: 6px; margin-right: 6px;
} }
.tooltip td.value{ .-tooltip td.value{
text-align: right; text-align: right;
} }

2
c3.js

@ -104,7 +104,7 @@
// tooltip - show when mouseover on each data // tooltip - show when mouseover on each data
var __tooltip_contents = getConfig(['tooltip','contents'], function(d) { var __tooltip_contents = getConfig(['tooltip','contents'], function(d) {
var date = isTimeSeries ? d[0].x.getFullYear() + '.' + (d[0].x.getMonth()+1) + '.' + d[0].x.getDate() : isCategorized ? category(d[0].x) : d[0].x, var date = isTimeSeries ? d[0].x.getFullYear() + '.' + (d[0].x.getMonth()+1) + '.' + d[0].x.getDate() : isCategorized ? category(d[0].x) : d[0].x,
text = "<table class='tooltip'><tr><th colspan='2'>" + date + "</th></tr>", i, value, name; text = "<table class='-tooltip'><tr><th colspan='2'>" + date + "</th></tr>", i, value, name;
for (i = 0; i < d.length; i++){ for (i = 0; i < d.length; i++){
if (isDefined(d[i])) { if (isDefined(d[i])) {
value = isDefined(d[i].value) ? (Math.round(d[i].value*100)/100).toFixed(2) : '-'; value = isDefined(d[i].value) ? (Math.round(d[i].value*100)/100).toFixed(2) : '-';

114
c3.min.js vendored

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

Loading…
Cancel
Save