Browse Source

Fix transition for axis

pull/57/head 0.1.15
Masayuki Tanaka 11 years ago
parent
commit
4a15e6610f
  1. 6
      c3.js
  2. 88
      c3.min.js

6
c3.js

@ -2199,8 +2199,8 @@
y2.domain(getYDomain('y2'));
// axis
main.select(".x.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? duration : 0).call(__axis_rotated ? yAxis : xAxis);
main.select(".y.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? 0 : duration).call(__axis_rotated ? xAxis : yAxis);
main.select(".x.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(duration).call(__axis_rotated ? yAxis : xAxis);
main.select(".y.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(duration).call(__axis_rotated ? xAxis : yAxis);
main.select(".y2.axis").style("opacity", hideAxis ? 0 : 1).transition().call(yAxis2);
// setup drawer - MEMO: these must be called after axis updated
@ -2386,7 +2386,7 @@
// update subchart elements if needed
if (withSubchart) {
// axes
context.select('.x.axis').style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? duration : 0).call(subXAxis);
context.select('.x.axis').style("opacity", hideAxis ? 0 : 1).transition().duration(duration).call(subXAxis);
// extent rect
if (!brush.empty()) {
brush.extent(x.orgDomain()).update();

88
c3.min.js vendored

@ -50,47 +50,47 @@ c,c.index)}))}).call(e.behavior.drag().origin(Object).on("drag",function(){xd(e.
a=a[1],k=Math.min(b,d),h=Math.max(b,d),m=xa?n:Math.min(c,a),p=xa?r:Math.max(c,a),l.select(".dragarea").attr("x",k).attr("y",m).attr("width",h-k).attr("height",p-m),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return ma(a)}).each(function(a,b){var c=e.select(this),d=c.classed(na),g=c.classed(nc),f,l,rd,n;f=!1;"circle"===this.nodeName?(f=1*c.attr("cx"),l=1*c.attr("cy"),n=ld,f=k<f&&f<h&&m<l&&l<p):"rect"===this.nodeName&&(f=1*c.attr("x"),l=1*c.attr("y"),rd=1*c.attr("width"),n=nd,f=
k<f+rd&&f<h&&l<p);f^g&&(c.classed(nc,!g),c.classed(na,!d),n(!d,c,a,b))}))}function yd(a){!B(f.data.targets)&&la&&(mc=a,l.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),cb=!0)}function zd(){!B(f.data.targets)&&la&&(l.select(".dragarea").transition().duration(100).style("opacity",0).remove(),l.selectAll(".-shape").classed(nc,!1),cb=!1)}function V(a){var b,c,d,k;d=ve();var p,t,x,u,v,w=B(f.data.targets),A,s;a=y(a)?a:{};c=y(a.withY)?a.withY:!0;k=y(a.withSubchart)?a.withSubchart:
!0;t=y(a.withTransition)?a.withTransition:!0;x=y(a.withTransform)?a.withTransform:!1;u=y(a.withUpdateXDomain)?a.withUpdateXDomain:!1;v=y(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1;s=t?Ue:0;a=y(a.durationForExit)?a.durationForExit:s;v&&(m.domain(e.extent(qb(f.data.targets))),aa=m.domain(),fa&&E.scale(m).updateScaleExtent(),T.domain(m.domain()),J.scale(T));u&&(m.domain(J.empty()?aa:J.extent()),fa&&E.scale(m).updateScaleExtent());D.domain(ob("y"));ba.domain(ob("y2"));l.select(".x.axis").style("opacity",
w?0:1).transition().duration(h?s:0).call(h?Qb:S);l.select(".y.axis").style("opacity",w?0:1).transition().duration(h?0:s).call(h?S:Qb);l.select(".y2.axis").style("opacity",w?0:1).transition().call(Ac);A=od(d);u=qd(d,!0);v=qd(d,!1);l.select(".x.axis .-axis-x-label").attr("x",q);kb.domain(D.domain());lb.domain(ba.domain());U.style("display","none");l.select("line.xgrid-focus").style("visibility","hidden").attr("y2",r);if(sd){if("year"===Ve){b=[];for(var z=qb(),C=z[0].getFullYear(),z=z[1].getFullYear();C<=
z;C++)b.push(new Date(C+"-01-01 00:00:00"))}else b=m.ticks(10);b=l.select(".xgrids").selectAll(".xgrid").data(b);b.enter().append("line").attr("class","xgrid");b.attr("x1",h?0:function(a){return m(a)-S.tickOffset()}).attr("x2",h?q:function(a){return m(a)-S.tickOffset()}).attr("y1",h?function(a){return m(a)-S.tickOffset()}:n).attr("y2",h?function(a){return m(a)-S.tickOffset()}:r).style("opacity",function(){return+e.select(this).attr(h?"y1":"x1")===(h?r:0)?0:1});b.exit().remove()}hc&&(b=l.selectAll(".xgrid-lines"),
b.selectAll("line").transition().duration(s).attr("x1",h?0:Za).attr("x2",h?q:Za).attr("y1",h?Za:n).attr("y2",h?Za:r),b.selectAll("text").attr("x",h?q:0).attr("y",Za));c&&td&&(b=l.select(".ygrids").selectAll(".ygrid").data(D.ticks(10)),b.enter().append("line").attr("class","ygrid"),b.attr("x1",h?D:0).attr("x2",h?D:q).attr("y1",h?0:D).attr("y2",h?r:D),b.exit().remove());c&&ic&&(c=l.select(".ygrid-lines"),c.selectAll("line").transition().duration(s).attr("x1",h?$a:0).attr("x2",h?$a:q).attr("y1",h?0:
$a).attr("y2",h?r:$a),c.selectAll("text").attr("x",h?0:q).attr("y",$a));c=l.selectAll(".-bars").selectAll(".-bar").data(hd);c.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return I(a.id)}).attr("class",Sc);c.style("opacity",Ca).transition().duration(s).attr("d",A).style("opacity",1);c.exit().transition().duration(a).style("opacity",0).remove();c=l.selectAll(".-texts").selectAll(".-text").data(Ae);c.enter().append("text").attr("class",le).attr("text-anchor",
function(a){return h?0>a.value?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Yb(a.value)});c.style("fill-opacity",se).transition().duration(s).attr("x",u).attr("y",v).style("fill-opacity",Uc);c.exit().transition().duration(a).style("fill-opacity",0).remove();l.selectAll(".-line").style("opacity",Ca).transition().duration(s).attr("d",We).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(s).attr("d",Xe).style("opacity",
Ad);a=l.selectAll(".-circles").selectAll(".-circle").data(ze);a.enter().append("circle").attr("class",qe).style("opacity",0).attr("r",ec);a.style("opacity",Ca).transition().duration(s).style("opacity",te).attr("cx",h?Ha:Ga).attr("cy",h?Ga:Ha);a.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(s).attrTween("d",function(a){a=oa(a);if(!a)return function(){return"M 0 0"};var b=e.interpolate(this._current,
a);this._current=b(0);return function(a){a=b(a);return gd(a.data)||Tb(a.data)?mb(a,!0):"M 0 0"}}).attr("transform",x?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",eb).style("opacity",0).transition().duration(s).text(Cb).style("opacity",function(a){return gd(a.data)||Tb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",$(f.data.targets,"donut")?1:0);Ia&&(null!==e.event&&"zoom"===e.event.type&&J.extent(m.orgDomain()).update(),k&&(G.select(".x.axis").style("opacity",
w?0:1).transition().duration(h?s:0).call(Pb),J.empty()||J.extent(m.orgDomain()).update(),k=od(d,!0),d=G.selectAll(".-bars").selectAll(".-bar").data(hd),d.enter().append("path").attr("d",k).style("stroke","none").style("fill",function(a){return I(a.id)}).attr("class",Sc),d.style("opacity",Ca).transition().duration(s).attr("d",k).style("opacity",1),d.exit().transition().duration(s).style("opacity",0).remove(),G.selectAll(".-line").style("opacity",Ca).transition().duration(s).attr("d",Ye).style("opacity",
1)));l.selectAll(".selected-circles").filter(function(a){return wa(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(s).attr("cx",h?Ha:Ga).attr("cy",h?Ga:Ha);ca?(k=l.select(".event-rects").selectAll(".event-rect").data([0]),Se(k.enter()),k.attr("x",0).attr("y",0).attr("width",q).attr("height",r)):(Wb?(p=function(a,b){var c=Nc(b),d=b<Ba()-1?f.data.targets[0].values[b+1].x:void 0;return(m(d?d:a.x+50)-m(c?c:a.x-50))/2},d=function(a,b){var c=Nc(b);return(m(a.x)+m(c?
c:a.x-50))/2}):(p=Gd(),d=function(a){return m(a.x)-p/2}),k=ke(),l.select(".event-rects").datum(k?k.values:[]),k=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Re(k.enter()),k.attr("class",Tc).attr("x",h?0:d).attr("y",h?d:0).attr("width",h?q:p).attr("height",h?p:r),k.exit().remove());d=l.select(".regions").selectAll("rect.region").data(O);d.enter().append("rect").style("fill-opacity",0);d.attr("class",re).attr("x",h?0:Vb).attr("y",h?Vb:n).attr("width",h?q:Ic).attr("height",
h?Ic:r).transition().duration(s).style("fill-opacity",function(a){return F(a.opacity)?a.opacity:0.1});d.exit().transition().duration(s).style("fill-opacity",0).remove();ia&&xb(f.data.targets,{withTransition:t});Xa().forEach(function(a){Xb[a]=!0})}function Ze(){"mousemove"===e.event.sourceEvent.type&&E.altDomain?(m.domain(E.altDomain),E.scale(m).updateScaleExtent()):(ja&&m.orgDomain()[0]===aa[0]&&m.domain([aa[0]-1E-10,m.orgDomain()[1]]),V({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===
e.event.sourceEvent.type&&(lc=!0))}function Qe(){function a(){b.forEach(function(a){a()})}var b=[];a.add=function(a){b.push(a)};return a}function W(a){var b;a=y(a)?a:{};b=y(a.withTransition)?a.withTransition:!1;a=y(a.withTransform)?a.withTransform:!1;qa();P();J.scale(T);fa&&E.scale(m);p.attr("width",Pa).attr("height",sa);p.select("#"+gc).select("rect").attr("width",q).attr("height",r);p.select("#xaxis-clip").select("rect").attr("width",ha);p.select(".zoom-rect").attr("width",q).attr("height",r);l.attr("transform",
K.main);l.select(".x.axis").attr("transform",K.x);l.select(".y2.axis").attr("transform",K.y2);l.select(".chart-arcs").attr("transform",K.arc);Ia&&(G.attr("transform",K.context),G.select(".x.axis").attr("transform",K.subx));var c=!1!==b?250:0;ia&&Ja.transition().duration(c).attr("transform",K.legend);V({withTransition:b,withUpdateXDomain:!0,withTransform:a,durationForExit:0})}function ud(a){var b;l.select(".chart-texts").selectAll(".chart-text").data(a).enter().append("g").attr("class",function(a){return"chart-text target target-"+
a.id}).style("pointer-events","none").append("g").attr("class",me).style("fill",function(a){return I(a.id)});l.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").append("g").attr("class",Rc).style("fill",function(a){return I(a.id)}).style("stroke","none").style("cursor",function(a){return ma(a)?"pointer":null});b=l.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");b.append("path").attr("class",Qc).style("opacity",0).style("stroke",function(a){return I(a.id)});b.append("path").attr("class",pe).style("opacity",function(){Ad=+e.select(this).style("opacity");return 0}).style("fill",function(a){return I(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",ne).style("fill",function(a){return I(a.id)}).style("cursor",
function(a){return ma(a)?"pointer":null});a.forEach(function(a){var b=yb(a.id);l.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Sb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id});b.append("path").attr("class",oe).style("opacity",0).style("fill",function(a){return I(a.data.id)}).style("cursor",function(a){return ma(a)?"pointer":null}).each(function(a){this._current=
a}).on("mouseover",function(a){wc(a.data.id);oc(a.data.id)}).on("mouseout",function(a){Ub(a.data.id);pc()});b.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none");Ia&&(b=G.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}),b.append("g").attr("class",Rc).style("fill",function(a){return I(a.id)}),b=G.select(".chart-lines").selectAll(".chart-line").data(a),
b=b.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}),b.append("path").attr("class",Qc).style("opacity",0).style("stroke",function(a){return I(a.id)}));ia&&xb(a);p.selectAll(".target").transition().style("opacity",1)}function db(a,b){f.data.targets.forEach(function(b){for(var d=0;d<a.length;d++)if(b.id===a[d].id){b.values=a[d].values;a.splice(d,1);break}});f.data.targets=f.data.targets.concat(a);ud(f.data.targets);V({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});
b()}function oc(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",0.3);b.filter(c).transition().duration(100).style("opacity",1)}function $e(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",1);b.filter(c).transition().duration(100).style("opacity",0.3)}function pc(){p.selectAll(".legend-item").transition().duration(100).style("opacity",
1)}function xb(a,b){var c=Xa(a),d,e,h,l,m,n,p,q=0,r=0,s,u,t;b=w(b)?{}:b;t=y(b.withTransition)?b.withTransition:!0;x?(e=function(){return 0.2*Qa},m=function(a,b){return s+q*b}):(e=function(a,b){return s+r*b},m=function(){return 0.2*ta});h=function(a,b){return e(a,b)+14};n=function(a,b){return m(a,b)+9};l=function(a,b){return e(a,b)-4};p=function(a,b){return m(a,b)-7};u=function(b){var c=b.getBBox();b=10*Math.ceil((c.width+30)/10);c=10*Math.ceil((c.height+4)/10);b>r&&(r=b,x||(s=(Qa-r*Object.keys(a).length)/
2));c>q&&(q=c,x&&(s=(ta-q*Object.keys(a).length)/2))};d=Ja.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){af(a)}).on("mouseover",function(a){oc(a);f.focus(a)}).on("mouseout",function(){pc();f.revert()});d.append("text").text(function(a){return y(Va[a])?Va[a]:a}).each(function(){u(this)}).style("pointer-events","none").attr("x",x?h:-200).attr("y",x?-200:m);d.append("rect").attr("class",
"legend-item-event").style("fill-opacity",0).attr("x",x?l:-200).attr("y",x?-200:p).attr("width",r+14).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return I(a)}).attr("x",x?h:-200).attr("y",x?-200:n).attr("width",10).attr("height",10);Ja.selectAll("text").data(c).each(function(){u(this)}).transition().duration(t?250:0).attr("x",h).attr("y",n);Ja.selectAll("rect.legend-item-event").data(c).transition().duration(t?250:0).attr("x",
l).attr("y",p);Ja.selectAll("rect.legend-item-tile").data(c).transition().duration(t?250:0).attr("x",e).attr("y",m)}function yb(a){return a?"-"+a.replace(/\./g,"\\."):""}function ka(a){return".target"+yb(a)}function qc(a){return Oc(a.id)}function rc(a){return"data"in a&&Oc(a.data.id)}var f={data:{}},rb={},ea="_expanded_",na="_selected_",nc="_included_",za=d(["bindto"],"#chart"),ra=d(["size","width"],null),Hb=d(["size","height"],null),gb=d(["padding","left"],null),zc=d(["padding","right"],null),fa=
d(["zoom","enabled"],!1),Bd=d(["zoom","extent"],null),Oe=d(["zoom","privileged"],!1),Ie=d(["onenter"],function(){}),Je=d(["onleave"],function(){}),Ue=d(["transition","duration"],350);if(!("data"in ga))throw Error("data is required in config");var va=d(["data","x"],null),ca=d(["data","xs"],null),$b=d(["data","x_format"],"%Y-%m-%d"),je=d(["data","id_converter"],function(a){return a}),Va=d(["data","names"],{}),u=d(["data","groups"],[]),Dc=d(["data","axes"],{}),Mc=d(["data","type"],null),z=d(["data",
"types"],{}),Da=d(["data","labels"],{}),Fa=d(["data","order"],null),Cd=d(["data","regions"],{}),bf=d(["data","colors"],{}),la=d(["data","selection","enabled"],!1),xa=d(["data","selection","grouped"],!1),ma=d(["data","selection","isselectable"],function(){return!0}),Ia=d(["subchart","show"],!1),Eb=Ia?d(["subchart","size","height"],60):0,cf=d(["color","pattern"],null),ia=d(["legend","show"],!0),df=d(["legend","position"],"bottom"),af=d(["legend","item","onclick"],function(){}),h=d(["axis","rotated"],
!1),sc=d(["axis","x","type"],"indexed"),Sa=d(["axis","x","categories"],[]),Pd=d(["axis","x","tick","centered"],!1),nb=d(["axis","x","tick","format"],null),Sd=d(["axis","x","tick","culling"],h||"categorized"===sc?!1:!0),Ec=d(["axis","x","tick","count"],10),wb=d(["axis","x","default"],null),Ke=d(["axis","x","label"],null),$d=d(["axis","y","max"],null),Yd=d(["axis","y","min"],null),be=d(["axis","y","center"],null),Le=d(["axis","y","label"],null),hb=d(["axis","y","inner"],!1),Rb=d(["axis","y","tick",
"format"],null),Ta=d(["axis","y","padding"],null),Ld=d(["axis","y","ticks"],10),fb=d(["axis","y2","show"],!1),Zd=d(["axis","y2","max"],null),Xd=d(["axis","y2","min"],null),ae=d(["axis","y2","center"],null),Ib=d(["axis","y2","inner"],!1),Nd=d(["axis","y2","tick","format"],null),Ua=d(["axis","y2","padding"],null),Od=d(["axis","y2","ticks"],10),sd=d(["grid","x","show"],!1),Ve=d(["grid","x","type"],"tick"),hc=d(["grid","x","lines"],null),td=d(["grid","y","show"],!1),ic=d(["grid","y","lines"],null),ec=
d(["point","show"],!0)?d(["point","r"],2.5):0,Me=d(["point","focus","line","enabled"],!0),jc=d(["point","focus","expand","enabled"],!0),kc=d(["point","focus","expand","r"],jc?4:ec),ab=d(["point","focus","select","r"],8),Te=d(["point","onclick"],function(){}),Ce=d(["point","onselected"],function(){}),De=d(["point","onunselected"],function(){}),Td=d(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),Ne=d(["arc","title"],""),O=d(["regions"],[]),bd=d(["tooltip","enabled"],!0),Dd=d(["tooltip",
"format","title"],null),Ed=d(["tooltip","format","value"],null),cd=d(["tooltip","contents"],function(a,b,c,d){b=Dd?Dd:b;c=Ed?Ed:c;var e,f,h,l;for(f=0;f<a.length;f++)a[f]&&(a[f].value||0===a[f].value)&&(e||(e=b?b(a[f].x):a[f].x,e="<table class='-tooltip'><tr><th colspan='2'>"+e+"</th></tr>"),l=a[f].name,h=c(a[f].value),e+="<tr class='-tooltip-name-"+a[f].id+"'><td class='name'><span style='background-color:"+d(a[f].id)+"'></span>"+l+"</td><td class='value'>"+h+"</td></tr>");return e+"</table>"}),Pe=
d(["tooltip","init","show"],!1),Ka=d(["tooltip","init","x"],0),vd=d(["tooltip","init","position"],{top:"0px",left:"50px"}),gc=za.replace("#","")+"-clip",bb="url("+document.URL+"#"+gc+")",C="timeseries"===sc,ja="categorized"===sc,Wb=!C&&(va||ca),mc=null,cb=!1,lc=!1,I=function(a,b){var c=[],d=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 d[c.indexOf(b)%d.length]}}(bf,
cf),Qd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}],[e.time.format(".%L"),function(a){return a.getMilliseconds()}]];
return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),q,Fb,r,ib,Pa,sa,ta,Qa,Ra,jb,Gb,mb,Bc,Cc,Sb,Jb,Kb,Lb,Mb,Nb,Ob,m,D,ba,T,kb,lb,S,Qb,Ac,Pb,Id=h?"left":"bottom",Kd=h?hb?"top":"bottom":hb?"right":"left",Md=h?Ib?"bottom":"top":Ib?"left":"right",Jd=h?"left":"bottom",K={main:function(){return"translate("+v+","+n+")"},context:function(){return"translate("+Na+","+Ab+")"},legend:function(){return"translate("+zb+","+tc+")"},y2:function(){return"translate("+(h?0:q)+","+(h?1:
0)+")"},x:function(){return"translate(0,"+r+")"},subx:function(){return"translate(0,"+(h?0:ib)+")"},arc:function(){return"translate("+q/2+","+r/2+")"}},x="right"===df,yc=40,xc=20;Sb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var We=function(){var a=e.svg.line().x(h?function(a){return t(a.id)(a.value)}:Ea).y(h?Ea:function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if(tb(b))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),
Cd[b.id]?He(c,m,t(b.id),Cd[b.id]):a(c);d=m(c[0].x);b=t(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Xe=function(){var a;a=h?e.svg.area().x0(function(a){return t(a.id)(0)}).x1(function(a){return t(a.id)(a.value)}).y(Ea):e.svg.area().x(Ea).y0(function(a){return t(a.id)(0)}).y1(function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if($([b],"area")||$([b],"area-spline"))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=t(b.id)(c[0].value);
return h?"M "+b+" "+d:"M "+d+" "+b}}(),Ye=function(){var a=e.svg.line().x(h?function(a){return H(a.id)(a.value)}:Wc).y(h?Wc:function(a){return H(a.id)(a.value)});return function(b){var c=bc(b.values);return tb(b)?a(c):"M "+T(c[0].x)+" "+H(b.id)(c[0].value)}}(),J,E=function(){};J=e.svg.brush().on("brush",function(){V({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})});J.update=function(){G&&G.select(".x.brush").call(this);return this};J.scale=function(a){return h?this.y(a):this.x(a)};
fa&&(E=e.behavior.zoom().on("zoomstart",function(){E.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",fa?Ze:null),E.scale=function(a){return h?this.y(a):this.x(a)},E.orgScaleExtent=function(){var a=Bd?Bd:[1,10];return[a[0],Math.max(Ba()/a[1],a[1])]},E.updateScaleExtent=function(){var a=Aa(m.orgDomain())/Aa(aa),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this});var p,vb,l,G,Ja,U,ub,aa,Ad,Xb={};f.focus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);
f.revert();f.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&wc(a,!0);oc(a)};f.defocus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);f.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);B(f.data.targets)&&Ub(a);$e(a)};f.revert=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);c.classed("focused",
!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&Ub(a);pc()};f.show=function(a){p.selectAll(ka(a)).transition().style("opacity",1)};f.hide=function(a){p.selectAll(ka(a)).transition().style("opacity",0)};f.unzoom=function(){J.clear().update();V({withUpdateXDomain:!0})};f.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&ie(a.xs);"categories"in a&&ja&&(Sa=a.categories,S.categories(Sa));if("cacheIds"in a&&ee(a.cacheIds))db(fe(a.cacheIds),
a.done);else if("data"in a)db(Wa(a.data),a.done);else if("url"in a)e.csv(a.url,function(b,c){db(Wa(c),a.done)});else if("rows"in a)db(Wa(Kc(a.rows)),a.done);else if("columns"in a)db(Wa(Lc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};f.unload=function(a){f.data.targets=f.data.targets.filter(function(b){return b.id!==a});p.selectAll(ka(a)).transition().style("opacity",0).remove();ia&&(p.selectAll(".legend-item"+yb(a)).remove(),xb(f.data.targets));0<f.data.targets.length&&
V({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};f.selected=function(a){a=yb(a);return e.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return e.select(this).classed(na)}).map(function(a){return a.map(function(a){return a.__data__})}))};f.select=function(a,b,c){la&&l.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?kd:Ee,l="circle"===this.nodeName?ac:md;0<=b.indexOf(f)?ma(d)&&(xa||w(a)||0<=a.indexOf(d.id))&&h(e.select(this).classed(na,
!0),d,f):y(c)&&c&&l(e.select(this).classed(na,!1),d,f)})};f.unselect=function(a,b){la&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var f="circle"===this.nodeName?ac:md;(w(b)||0<=b.indexOf(d))&&ma(c)&&(xa||w(a)||0<=a.indexOf(c.id))&&f(e.select(this).classed(na,!1),c,d)})};f.toLine=function(a){da(a,"line");W({withTransition:!0})};f.toSpline=function(a){da(a,"spline");W({withTransition:!0})};f.toBar=function(a){da(a,"bar");W({withTransition:!0})};f.toScatter=function(a){da(a,"scatter");
W({withTransition:!0})};f.toArea=function(a){da(a,"area");W({withTransition:!0})};f.toAreaSpline=function(a){da(a,"area-spline");W({withTransition:!0})};f.toPie=function(a){da(a,"pie");W({withTransition:!0,withTransform:!0})};f.toDonut=function(a){da(a,"donut");W({withTransition:!0,withTransform:!0})};f.groups=function(a){if(w(a))return u;u=a;V();return u};f.regions=function(a){if(w(a))return O;O=a;V();return O};f.regions.add=function(a){if(w(a))return O;O=O.concat(a);V();return O};f.regions.remove=
function(a,b){var c=[].concat(a);b=y(b)?b:{};c.forEach(function(a){var c=F(b.duration)?b.duration:0;p.selectAll("."+a).transition().duration(c).style("fill-opacity",0).remove();O=O.filter(function(b){return 0>b.classes.indexOf(a)})});return O};f.data.get=function(a){a=f.data.getAsTarget(a);return y(a)?a.values.map(function(a){return a.value}):void 0};f.data.getAsTarget=function(a){var b=pb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};f.resize=function(a){ra=a?a.width:null;Hb=a?a.height:
null;W()};f.destroy=function(){f.data.targets=void 0;f.data.x={};ub.html("");N.onresize=null};if("url"in ga.data)e.csv(ga.data.url,function(a,b){fc(b)});else if("rows"in ga.data)fc(Kc(ga.data.rows));else if("columns"in ga.data)fc(Lc(ga.data.columns));else throw Error("url or rows or columns is required.");return f}})(window);
w?0:1).transition().duration(s).call(h?Qb:S);l.select(".y.axis").style("opacity",w?0:1).transition().duration(s).call(h?S:Qb);l.select(".y2.axis").style("opacity",w?0:1).transition().call(Ac);A=od(d);u=qd(d,!0);v=qd(d,!1);l.select(".x.axis .-axis-x-label").attr("x",q);kb.domain(D.domain());lb.domain(ba.domain());U.style("display","none");l.select("line.xgrid-focus").style("visibility","hidden").attr("y2",r);if(sd){if("year"===Ve){b=[];for(var z=qb(),C=z[0].getFullYear(),z=z[1].getFullYear();C<=z;C++)b.push(new Date(C+
"-01-01 00:00:00"))}else b=m.ticks(10);b=l.select(".xgrids").selectAll(".xgrid").data(b);b.enter().append("line").attr("class","xgrid");b.attr("x1",h?0:function(a){return m(a)-S.tickOffset()}).attr("x2",h?q:function(a){return m(a)-S.tickOffset()}).attr("y1",h?function(a){return m(a)-S.tickOffset()}:n).attr("y2",h?function(a){return m(a)-S.tickOffset()}:r).style("opacity",function(){return+e.select(this).attr(h?"y1":"x1")===(h?r:0)?0:1});b.exit().remove()}hc&&(b=l.selectAll(".xgrid-lines"),b.selectAll("line").transition().duration(s).attr("x1",
h?0:Za).attr("x2",h?q:Za).attr("y1",h?Za:n).attr("y2",h?Za:r),b.selectAll("text").attr("x",h?q:0).attr("y",Za));c&&td&&(b=l.select(".ygrids").selectAll(".ygrid").data(D.ticks(10)),b.enter().append("line").attr("class","ygrid"),b.attr("x1",h?D:0).attr("x2",h?D:q).attr("y1",h?0:D).attr("y2",h?r:D),b.exit().remove());c&&ic&&(c=l.select(".ygrid-lines"),c.selectAll("line").transition().duration(s).attr("x1",h?$a:0).attr("x2",h?$a:q).attr("y1",h?0:$a).attr("y2",h?r:$a),c.selectAll("text").attr("x",h?0:
q).attr("y",$a));c=l.selectAll(".-bars").selectAll(".-bar").data(hd);c.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return I(a.id)}).attr("class",Sc);c.style("opacity",Ca).transition().duration(s).attr("d",A).style("opacity",1);c.exit().transition().duration(a).style("opacity",0).remove();c=l.selectAll(".-texts").selectAll(".-text").data(Ae);c.enter().append("text").attr("class",le).attr("text-anchor",function(a){return h?0>a.value?"end":"start":
"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Yb(a.value)});c.style("fill-opacity",se).transition().duration(s).attr("x",u).attr("y",v).style("fill-opacity",Uc);c.exit().transition().duration(a).style("fill-opacity",0).remove();l.selectAll(".-line").style("opacity",Ca).transition().duration(s).attr("d",We).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(s).attr("d",Xe).style("opacity",Ad);a=l.selectAll(".-circles").selectAll(".-circle").data(ze);
a.enter().append("circle").attr("class",qe).style("opacity",0).attr("r",ec);a.style("opacity",Ca).transition().duration(s).style("opacity",te).attr("cx",h?Ha:Ga).attr("cy",h?Ga:Ha);a.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(s).attrTween("d",function(a){a=oa(a);if(!a)return function(){return"M 0 0"};var b=e.interpolate(this._current,a);this._current=b(0);return function(a){a=
b(a);return gd(a.data)||Tb(a.data)?mb(a,!0):"M 0 0"}}).attr("transform",x?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",eb).style("opacity",0).transition().duration(s).text(Cb).style("opacity",function(a){return gd(a.data)||Tb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",$(f.data.targets,"donut")?1:0);Ia&&(null!==e.event&&"zoom"===e.event.type&&J.extent(m.orgDomain()).update(),k&&(G.select(".x.axis").style("opacity",w?0:1).transition().duration(s).call(Pb),
J.empty()||J.extent(m.orgDomain()).update(),k=od(d,!0),d=G.selectAll(".-bars").selectAll(".-bar").data(hd),d.enter().append("path").attr("d",k).style("stroke","none").style("fill",function(a){return I(a.id)}).attr("class",Sc),d.style("opacity",Ca).transition().duration(s).attr("d",k).style("opacity",1),d.exit().transition().duration(s).style("opacity",0).remove(),G.selectAll(".-line").style("opacity",Ca).transition().duration(s).attr("d",Ye).style("opacity",1)));l.selectAll(".selected-circles").filter(function(a){return wa(a)}).selectAll("circle").remove();
l.selectAll(".selected-circle").transition().duration(s).attr("cx",h?Ha:Ga).attr("cy",h?Ga:Ha);ca?(k=l.select(".event-rects").selectAll(".event-rect").data([0]),Se(k.enter()),k.attr("x",0).attr("y",0).attr("width",q).attr("height",r)):(Wb?(p=function(a,b){var c=Nc(b),d=b<Ba()-1?f.data.targets[0].values[b+1].x:void 0;return(m(d?d:a.x+50)-m(c?c:a.x-50))/2},d=function(a,b){var c=Nc(b);return(m(a.x)+m(c?c:a.x-50))/2}):(p=Gd(),d=function(a){return m(a.x)-p/2}),k=ke(),l.select(".event-rects").datum(k?k.values:
[]),k=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Re(k.enter()),k.attr("class",Tc).attr("x",h?0:d).attr("y",h?d:0).attr("width",h?q:p).attr("height",h?p:r),k.exit().remove());d=l.select(".regions").selectAll("rect.region").data(O);d.enter().append("rect").style("fill-opacity",0);d.attr("class",re).attr("x",h?0:Vb).attr("y",h?Vb:n).attr("width",h?q:Ic).attr("height",h?Ic:r).transition().duration(s).style("fill-opacity",function(a){return F(a.opacity)?a.opacity:0.1});
d.exit().transition().duration(s).style("fill-opacity",0).remove();ia&&xb(f.data.targets,{withTransition:t});Xa().forEach(function(a){Xb[a]=!0})}function Ze(){"mousemove"===e.event.sourceEvent.type&&E.altDomain?(m.domain(E.altDomain),E.scale(m).updateScaleExtent()):(ja&&m.orgDomain()[0]===aa[0]&&m.domain([aa[0]-1E-10,m.orgDomain()[1]]),V({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===e.event.sourceEvent.type&&(lc=!0))}function Qe(){function a(){b.forEach(function(a){a()})}var b=[];a.add=
function(a){b.push(a)};return a}function W(a){var b;a=y(a)?a:{};b=y(a.withTransition)?a.withTransition:!1;a=y(a.withTransform)?a.withTransform:!1;qa();P();J.scale(T);fa&&E.scale(m);p.attr("width",Pa).attr("height",sa);p.select("#"+gc).select("rect").attr("width",q).attr("height",r);p.select("#xaxis-clip").select("rect").attr("width",ha);p.select(".zoom-rect").attr("width",q).attr("height",r);l.attr("transform",K.main);l.select(".x.axis").attr("transform",K.x);l.select(".y2.axis").attr("transform",
K.y2);l.select(".chart-arcs").attr("transform",K.arc);Ia&&(G.attr("transform",K.context),G.select(".x.axis").attr("transform",K.subx));var c=!1!==b?250:0;ia&&Ja.transition().duration(c).attr("transform",K.legend);V({withTransition:b,withUpdateXDomain:!0,withTransform:a,durationForExit:0})}function ud(a){var b;l.select(".chart-texts").selectAll(".chart-text").data(a).enter().append("g").attr("class",function(a){return"chart-text target target-"+a.id}).style("pointer-events","none").append("g").attr("class",
me).style("fill",function(a){return I(a.id)});l.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").append("g").attr("class",Rc).style("fill",function(a){return I(a.id)}).style("stroke","none").style("cursor",function(a){return ma(a)?"pointer":null});b=l.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");b.append("path").attr("class",Qc).style("opacity",0).style("stroke",function(a){return I(a.id)});b.append("path").attr("class",pe).style("opacity",function(){Ad=+e.select(this).style("opacity");return 0}).style("fill",function(a){return I(a.id)});b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",ne).style("fill",function(a){return I(a.id)}).style("cursor",function(a){return ma(a)?"pointer":null});
a.forEach(function(a){var b=yb(a.id);l.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Sb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id});b.append("path").attr("class",oe).style("opacity",0).style("fill",function(a){return I(a.data.id)}).style("cursor",function(a){return ma(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",
function(a){wc(a.data.id);oc(a.data.id)}).on("mouseout",function(a){Ub(a.data.id);pc()});b.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none");Ia&&(b=G.select(".chart-bars").selectAll(".chart-bar").data(a),b=b.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}),b.append("g").attr("class",Rc).style("fill",function(a){return I(a.id)}),b=G.select(".chart-lines").selectAll(".chart-line").data(a),b=b.enter().append("g").attr("class",
function(a){return"chart-line target target-"+a.id}),b.append("path").attr("class",Qc).style("opacity",0).style("stroke",function(a){return I(a.id)}));ia&&xb(a);p.selectAll(".target").transition().style("opacity",1)}function db(a,b){f.data.targets.forEach(function(b){for(var d=0;d<a.length;d++)if(b.id===a[d].id){b.values=a[d].values;a.splice(d,1);break}});f.data.targets=f.data.targets.concat(a);ud(f.data.targets);V({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});b()}function oc(a){var b=p.selectAll(".legend-item"),
c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",0.3);b.filter(c).transition().duration(100).style("opacity",1)}function $e(a){var b=p.selectAll(".legend-item"),c=function(b){return!a||b===a};b.filter(function(a){return!c(a)}).transition().duration(100).style("opacity",1);b.filter(c).transition().duration(100).style("opacity",0.3)}function pc(){p.selectAll(".legend-item").transition().duration(100).style("opacity",1)}function xb(a,b){var c=
Xa(a),d,e,h,l,m,n,p,q=0,r=0,s,u,t;b=w(b)?{}:b;t=y(b.withTransition)?b.withTransition:!0;x?(e=function(){return 0.2*Qa},m=function(a,b){return s+q*b}):(e=function(a,b){return s+r*b},m=function(){return 0.2*ta});h=function(a,b){return e(a,b)+14};n=function(a,b){return m(a,b)+9};l=function(a,b){return e(a,b)-4};p=function(a,b){return m(a,b)-7};u=function(b){var c=b.getBBox();b=10*Math.ceil((c.width+30)/10);c=10*Math.ceil((c.height+4)/10);b>r&&(r=b,x||(s=(Qa-r*Object.keys(a).length)/2));c>q&&(q=c,x&&
(s=(ta-q*Object.keys(a).length)/2))};d=Ja.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){af(a)}).on("mouseover",function(a){oc(a);f.focus(a)}).on("mouseout",function(){pc();f.revert()});d.append("text").text(function(a){return y(Va[a])?Va[a]:a}).each(function(){u(this)}).style("pointer-events","none").attr("x",x?h:-200).attr("y",x?-200:m);d.append("rect").attr("class","legend-item-event").style("fill-opacity",
0).attr("x",x?l:-200).attr("y",x?-200:p).attr("width",r+14).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return I(a)}).attr("x",x?h:-200).attr("y",x?-200:n).attr("width",10).attr("height",10);Ja.selectAll("text").data(c).each(function(){u(this)}).transition().duration(t?250:0).attr("x",h).attr("y",n);Ja.selectAll("rect.legend-item-event").data(c).transition().duration(t?250:0).attr("x",l).attr("y",p);Ja.selectAll("rect.legend-item-tile").data(c).transition().duration(t?
250:0).attr("x",e).attr("y",m)}function yb(a){return a?"-"+a.replace(/\./g,"\\."):""}function ka(a){return".target"+yb(a)}function qc(a){return Oc(a.id)}function rc(a){return"data"in a&&Oc(a.data.id)}var f={data:{}},rb={},ea="_expanded_",na="_selected_",nc="_included_",za=d(["bindto"],"#chart"),ra=d(["size","width"],null),Hb=d(["size","height"],null),gb=d(["padding","left"],null),zc=d(["padding","right"],null),fa=d(["zoom","enabled"],!1),Bd=d(["zoom","extent"],null),Oe=d(["zoom","privileged"],!1),
Ie=d(["onenter"],function(){}),Je=d(["onleave"],function(){}),Ue=d(["transition","duration"],350);if(!("data"in ga))throw Error("data is required in config");var va=d(["data","x"],null),ca=d(["data","xs"],null),$b=d(["data","x_format"],"%Y-%m-%d"),je=d(["data","id_converter"],function(a){return a}),Va=d(["data","names"],{}),u=d(["data","groups"],[]),Dc=d(["data","axes"],{}),Mc=d(["data","type"],null),z=d(["data","types"],{}),Da=d(["data","labels"],{}),Fa=d(["data","order"],null),Cd=d(["data","regions"],
{}),bf=d(["data","colors"],{}),la=d(["data","selection","enabled"],!1),xa=d(["data","selection","grouped"],!1),ma=d(["data","selection","isselectable"],function(){return!0}),Ia=d(["subchart","show"],!1),Eb=Ia?d(["subchart","size","height"],60):0,cf=d(["color","pattern"],null),ia=d(["legend","show"],!0),df=d(["legend","position"],"bottom"),af=d(["legend","item","onclick"],function(){}),h=d(["axis","rotated"],!1),sc=d(["axis","x","type"],"indexed"),Sa=d(["axis","x","categories"],[]),Pd=d(["axis","x",
"tick","centered"],!1),nb=d(["axis","x","tick","format"],null),Sd=d(["axis","x","tick","culling"],h||"categorized"===sc?!1:!0),Ec=d(["axis","x","tick","count"],10),wb=d(["axis","x","default"],null),Ke=d(["axis","x","label"],null),$d=d(["axis","y","max"],null),Yd=d(["axis","y","min"],null),be=d(["axis","y","center"],null),Le=d(["axis","y","label"],null),hb=d(["axis","y","inner"],!1),Rb=d(["axis","y","tick","format"],null),Ta=d(["axis","y","padding"],null),Ld=d(["axis","y","ticks"],10),fb=d(["axis",
"y2","show"],!1),Zd=d(["axis","y2","max"],null),Xd=d(["axis","y2","min"],null),ae=d(["axis","y2","center"],null),Ib=d(["axis","y2","inner"],!1),Nd=d(["axis","y2","tick","format"],null),Ua=d(["axis","y2","padding"],null),Od=d(["axis","y2","ticks"],10),sd=d(["grid","x","show"],!1),Ve=d(["grid","x","type"],"tick"),hc=d(["grid","x","lines"],null),td=d(["grid","y","show"],!1),ic=d(["grid","y","lines"],null),ec=d(["point","show"],!0)?d(["point","r"],2.5):0,Me=d(["point","focus","line","enabled"],!0),jc=
d(["point","focus","expand","enabled"],!0),kc=d(["point","focus","expand","r"],jc?4:ec),ab=d(["point","focus","select","r"],8),Te=d(["point","onclick"],function(){}),Ce=d(["point","onselected"],function(){}),De=d(["point","onunselected"],function(){}),Td=d(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),Ne=d(["arc","title"],""),O=d(["regions"],[]),bd=d(["tooltip","enabled"],!0),Dd=d(["tooltip","format","title"],null),Ed=d(["tooltip","format","value"],null),cd=d(["tooltip","contents"],
function(a,b,c,d){b=Dd?Dd:b;c=Ed?Ed:c;var e,f,h,l;for(f=0;f<a.length;f++)a[f]&&(a[f].value||0===a[f].value)&&(e||(e=b?b(a[f].x):a[f].x,e="<table class='-tooltip'><tr><th colspan='2'>"+e+"</th></tr>"),l=a[f].name,h=c(a[f].value),e+="<tr class='-tooltip-name-"+a[f].id+"'><td class='name'><span style='background-color:"+d(a[f].id)+"'></span>"+l+"</td><td class='value'>"+h+"</td></tr>");return e+"</table>"}),Pe=d(["tooltip","init","show"],!1),Ka=d(["tooltip","init","x"],0),vd=d(["tooltip","init","position"],
{top:"0px",left:"50px"}),gc=za.replace("#","")+"-clip",bb="url("+document.URL+"#"+gc+")",C="timeseries"===sc,ja="categorized"===sc,Wb=!C&&(va||ca),mc=null,cb=!1,lc=!1,I=function(a,b){var c=[],d=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 d[c.indexOf(b)%d.length]}}(bf,cf),Qd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),
function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}],[e.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),q,Fb,
r,ib,Pa,sa,ta,Qa,Ra,jb,Gb,mb,Bc,Cc,Sb,Jb,Kb,Lb,Mb,Nb,Ob,m,D,ba,T,kb,lb,S,Qb,Ac,Pb,Id=h?"left":"bottom",Kd=h?hb?"top":"bottom":hb?"right":"left",Md=h?Ib?"bottom":"top":Ib?"left":"right",Jd=h?"left":"bottom",K={main:function(){return"translate("+v+","+n+")"},context:function(){return"translate("+Na+","+Ab+")"},legend:function(){return"translate("+zb+","+tc+")"},y2:function(){return"translate("+(h?0:q)+","+(h?1:0)+")"},x:function(){return"translate(0,"+r+")"},subx:function(){return"translate(0,"+(h?
0:ib)+")"},arc:function(){return"translate("+q/2+","+r/2+")"}},x="right"===df,yc=40,xc=20;Sb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var We=function(){var a=e.svg.line().x(h?function(a){return t(a.id)(a.value)}:Ea).y(h?Ea:function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if(tb(b))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),Cd[b.id]?He(c,m,t(b.id),Cd[b.id]):a(c);d=m(c[0].x);b=t(b.id)(c[0].value);return h?
"M "+b+" "+d:"M "+d+" "+b}}(),Xe=function(){var a;a=h?e.svg.area().x0(function(a){return t(a.id)(0)}).x1(function(a){return t(a.id)(a.value)}).y(Ea):e.svg.area().x(Ea).y0(function(a){return t(a.id)(0)}).y1(function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if($([b],"area")||$([b],"area-spline"))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=t(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Ye=function(){var a=e.svg.line().x(h?
function(a){return H(a.id)(a.value)}:Wc).y(h?Wc:function(a){return H(a.id)(a.value)});return function(b){var c=bc(b.values);return tb(b)?a(c):"M "+T(c[0].x)+" "+H(b.id)(c[0].value)}}(),J,E=function(){};J=e.svg.brush().on("brush",function(){V({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})});J.update=function(){G&&G.select(".x.brush").call(this);return this};J.scale=function(a){return h?this.y(a):this.x(a)};fa&&(E=e.behavior.zoom().on("zoomstart",function(){E.altDomain=e.event.sourceEvent.altKey?
m.orgDomain():null}).on("zoom",fa?Ze:null),E.scale=function(a){return h?this.y(a):this.x(a)},E.orgScaleExtent=function(){var a=Bd?Bd:[1,10];return[a[0],Math.max(Ba()/a[1],a[1])]},E.updateScaleExtent=function(){var a=Aa(m.orgDomain())/Aa(aa),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this});var p,vb,l,G,Ja,U,ub,aa,Ad,Xb={};f.focus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);f.revert();f.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",
1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&wc(a,!0);oc(a)};f.defocus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);f.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);B(f.data.targets)&&Ub(a);$e(a)};f.revert=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",
1);B(f.data.targets)&&Ub(a);pc()};f.show=function(a){p.selectAll(ka(a)).transition().style("opacity",1)};f.hide=function(a){p.selectAll(ka(a)).transition().style("opacity",0)};f.unzoom=function(){J.clear().update();V({withUpdateXDomain:!0})};f.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&ie(a.xs);"categories"in a&&ja&&(Sa=a.categories,S.categories(Sa));if("cacheIds"in a&&ee(a.cacheIds))db(fe(a.cacheIds),a.done);else if("data"in a)db(Wa(a.data),a.done);else if("url"in a)e.csv(a.url,
function(b,c){db(Wa(c),a.done)});else if("rows"in a)db(Wa(Kc(a.rows)),a.done);else if("columns"in a)db(Wa(Lc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};f.unload=function(a){f.data.targets=f.data.targets.filter(function(b){return b.id!==a});p.selectAll(ka(a)).transition().style("opacity",0).remove();ia&&(p.selectAll(".legend-item"+yb(a)).remove(),xb(f.data.targets));0<f.data.targets.length&&V({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};f.selected=function(a){a=
yb(a);return e.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return e.select(this).classed(na)}).map(function(a){return a.map(function(a){return a.__data__})}))};f.select=function(a,b,c){la&&l.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?kd:Ee,l="circle"===this.nodeName?ac:md;0<=b.indexOf(f)?ma(d)&&(xa||w(a)||0<=a.indexOf(d.id))&&h(e.select(this).classed(na,!0),d,f):y(c)&&c&&l(e.select(this).classed(na,!1),d,f)})};f.unselect=
function(a,b){la&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var f="circle"===this.nodeName?ac:md;(w(b)||0<=b.indexOf(d))&&ma(c)&&(xa||w(a)||0<=a.indexOf(c.id))&&f(e.select(this).classed(na,!1),c,d)})};f.toLine=function(a){da(a,"line");W({withTransition:!0})};f.toSpline=function(a){da(a,"spline");W({withTransition:!0})};f.toBar=function(a){da(a,"bar");W({withTransition:!0})};f.toScatter=function(a){da(a,"scatter");W({withTransition:!0})};f.toArea=function(a){da(a,"area");W({withTransition:!0})};
f.toAreaSpline=function(a){da(a,"area-spline");W({withTransition:!0})};f.toPie=function(a){da(a,"pie");W({withTransition:!0,withTransform:!0})};f.toDonut=function(a){da(a,"donut");W({withTransition:!0,withTransform:!0})};f.groups=function(a){if(w(a))return u;u=a;V();return u};f.regions=function(a){if(w(a))return O;O=a;V();return O};f.regions.add=function(a){if(w(a))return O;O=O.concat(a);V();return O};f.regions.remove=function(a,b){var c=[].concat(a);b=y(b)?b:{};c.forEach(function(a){var c=F(b.duration)?
b.duration:0;p.selectAll("."+a).transition().duration(c).style("fill-opacity",0).remove();O=O.filter(function(b){return 0>b.classes.indexOf(a)})});return O};f.data.get=function(a){a=f.data.getAsTarget(a);return y(a)?a.values.map(function(a){return a.value}):void 0};f.data.getAsTarget=function(a){var b=pb(function(b){return b.id===a});return 0<b.length?b[0]:void 0};f.resize=function(a){ra=a?a.width:null;Hb=a?a.height:null;W()};f.destroy=function(){f.data.targets=void 0;f.data.x={};ub.html("");N.onresize=
null};if("url"in ga.data)e.csv(ga.data.url,function(a,b){fc(b)});else if("rows"in ga.data)fc(Kc(ga.data.rows));else if("columns"in ga.data)fc(Lc(ga.data.columns));else throw Error("url or rows or columns is required.");return f}})(window);

Loading…
Cancel
Save