Browse Source

Add transition.duration option

pull/34/merge
Masayuki Tanaka 11 years ago
parent
commit
e61447dbdf
  1. 4
      c3.js
  2. 42
      c3.min.js

4
c3.js

@ -45,6 +45,8 @@
var __onenter = getConfig(['onenter'], function () {}),
__onleave = getConfig(['onleave'], function () {});
var __transition_duration = getConfig(['transition', 'duration'], 350);
// data - data configuration
checkConfig('data', 'data is required in config');
@ -2017,7 +2019,7 @@
withUpdateXDomain = isDefined(options.withUpdateXDomain) ? options.withUpdateXDomain : false;
withUpdateOrgXDomain = isDefined(options.withUpdateOrgXDomain) ? options.withUpdateOrgXDomain : false;
duration = withTransition ? 350 : 0;
duration = withTransition ? __transition_duration : 0;
if (withUpdateOrgXDomain) {
x.domain(d3.extent(getXDomain(c3.data.targets)));

42
c3.min.js vendored

@ -45,42 +45,42 @@ function(){nd(e.mouse(this))}).on("dragend",function(){od()})).call(F).on("dblcl
"pointer"):n.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;E(k.data.targets)||(a=e.mouse(this),c=Rc(k.data.targets,a),100>Rb(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){ld(this,c,c.index)}))}).call(e.behavior.drag().origin(Object).on("drag",function(){md(e.mouse(this))}).on("dragstart",function(){nd(e.mouse(this))}).on("dragend",function(){od()})).call(F).on("dblclick.zoom",null)}function ld(a,b,c){var d=e.select(a),f=d.classed(ma),g=
!1,h;"circle"===a.nodeName?(g=$c(a,1.5*Ua),h=cd):"rect"===a.nodeName&&(g=ad(a),h=ed);if(ta||g)ka&&la(b)&&(d.classed(ma,!f),h(!f,d,b,c)),Be(b,d)}function md(a){var b,c,d,f,g,h,m;E(k.data.targets)||!ka||sa&&!F.altDomain||(b=gc[0],c=gc[1],d=a[0],a=a[1],f=Math.min(b,d),g=Math.max(b,d),h=ta?t:Math.min(c,a),m=ta?s:Math.max(c,a),l.select(".dragarea").attr("x",f).attr("y",h).attr("width",g-f).attr("height",m-h),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return la(a)}).each(function(a,
b){var c=e.select(this),d=c.classed(ma),k=c.classed(hc),l,n,p,q;l=!1;"circle"===this.nodeName?(l=1*c.attr("cx"),n=1*c.attr("cy"),q=cd,l=f<l&&l<g&&h<n&&n<m):"rect"===this.nodeName&&(l=1*c.attr("x"),n=1*c.attr("y"),p=1*c.attr("width"),q=ed,l=f<l+p&&l<g&&n<m);l^k&&(c.classed(hc,!k),c.classed(ma,!d),q(!d,c,a,b))}))}function nd(a){!E(k.data.targets)&&ka&&(gc=a,l.select(".chart").append("rect").attr("class","dragarea").style("opacity",0.1),Wa=!0)}function od(){!E(k.data.targets)&&ka&&(l.select(".dragarea").transition().duration(100).style("opacity",
0).remove(),l.selectAll(".-shape").classed(hc,!1),Wa=!1)}function x(a){var b,c,d,f;d=be();var g,u,n,p=E(k.data.targets);a=q(a)?a:{};c=q(a.withY)?a.withY:!0;f=q(a.withSubchart)?a.withSubchart:!0;u=q(a.withTransition)?a.withTransition:!0;n=q(a.withTransform)?a.withTransform:!1;b=q(a.withUpdateXDomain)?a.withUpdateXDomain:!1;a=q(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1;u=u?350:0;a&&(m.domain(e.extent(pb(k.data.targets))),T=m.domain(),F.scale(m).updateScaleExtent(),U.domain(m.domain()),K.scale(U));
0).remove(),l.selectAll(".-shape").classed(hc,!1),Wa=!1)}function x(a){var b,c,d,f;d=be();var g,u,n,p=E(k.data.targets);a=q(a)?a:{};c=q(a.withY)?a.withY:!0;f=q(a.withSubchart)?a.withSubchart:!0;u=q(a.withTransition)?a.withTransition:!0;n=q(a.withTransform)?a.withTransform:!1;b=q(a.withUpdateXDomain)?a.withUpdateXDomain:!1;a=q(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1;u=u?Ce:0;a&&(m.domain(e.extent(pb(k.data.targets))),T=m.domain(),F.scale(m).updateScaleExtent(),U.domain(m.domain()),K.scale(U));
b&&(m.domain(K.empty()?T:K.extent()),sa&&F.scale(m).updateScaleExtent());z.domain(nb("y"));aa.domain(nb("y2"));l.select(".x.axis").style("opacity",p?0:1).transition().duration(h?u:0).call(h?ya:J);l.select(".y.axis").style("opacity",p?0:1).transition().duration(h?0:u).call(h?J:ya);l.select(".y2.axis").style("opacity",p?0:1).transition().call(kb);l.select(".x.axis .-axis-x-label").attr("x",r);ib.domain(z.domain());jb.domain(aa.domain());V.style("display","none");l.select("line.xgrid-focus").style("visibility",
"hidden").attr("y2",s);if(hd){if("year"===Ce){b=[];var v=pb();a=v[0].getFullYear();for(v=v[1].getFullYear();a<=v;a++)b.push(new Date(a+"-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)-J.tickOffset()}).attr("x2",h?r:function(a){return m(a)-J.tickOffset()}).attr("y1",h?function(a){return m(a)-J.tickOffset()}:t).attr("y2",h?function(a){return m(a)-J.tickOffset()}:s).style("opacity",
"hidden").attr("y2",s);if(hd){if("year"===De){b=[];var v=pb();a=v[0].getFullYear();for(v=v[1].getFullYear();a<=v;a++)b.push(new Date(a+"-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)-J.tickOffset()}).attr("x2",h?r:function(a){return m(a)-J.tickOffset()}).attr("y1",h?function(a){return m(a)-J.tickOffset()}:t).attr("y2",h?function(a){return m(a)-J.tickOffset()}:s).style("opacity",
function(){return+e.select(this).attr(h?"y1":"x1")===(h?s:0)?0:1});b.exit().remove()}bc&&(b=l.selectAll(".xgrid-lines"),b.selectAll("line").transition().duration(u).attr("x1",h?0:Ra).attr("x2",h?r:Ra).attr("y1",h?Ra:t).attr("y2",h?Ra:s),b.selectAll("text").attr("x",h?r:0).attr("y",Ra));c&&id&&(b=l.select(".ygrids").selectAll(".ygrid").data(z.ticks(10)),b.enter().append("line").attr("class","ygrid"),b.attr("x1",h?z:0).attr("x2",h?z:r).attr("y1",h?0:z).attr("y2",h?s:z),b.exit().remove());c&&cc&&(c=
l.select(".ygrid-lines"),c.selectAll("line").transition().duration(u).attr("x1",h?Sa:0).attr("x2",h?Sa:r).attr("y1",h?0:Sa).attr("y2",h?s:Sa),c.selectAll("text").attr("x",h?0:r).attr("y",Sa));c=l.selectAll(".-bars").selectAll(".-bar").data(Zc);c.enter().append("path").attr("d",xb(d,!1)).style("stroke","none").style("opacity",0).style("fill",function(a){return N(a.id)}).attr("class",Kc);c.style("opacity",Ta).transition().duration(u).attr("d",xb(d,!1)).style("opacity",1);c.exit().transition().duration(u).style("opacity",
0).remove();l.selectAll(".-line").style("opacity",Ta).transition().duration(u).attr("d",De).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(u).attr("d",Ee).style("opacity",pd);c=l.selectAll(".-circles").selectAll(".-circle").data(fe);c.enter().append("circle").attr("class",Zd).style("opacity",0).attr("r",Zb);c.style("opacity",Ta).transition().duration(u).style("opacity",ae).attr("cx",h?Ba:Aa).attr("cy",h?Aa:Ba);c.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform",
0).remove();l.selectAll(".-line").style("opacity",Ta).transition().duration(u).attr("d",Ee).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(u).attr("d",Fe).style("opacity",pd);c=l.selectAll(".-circles").selectAll(".-circle").data(fe);c.enter().append("circle").attr("class",Zd).style("opacity",0).attr("r",Zb);c.style("opacity",Ta).transition().duration(u).style("opacity",ae).attr("cx",h?Ba:Aa).attr("cy",h?Aa:Ba);c.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform",
n?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(u).attrTween("d",function(a){a=Z(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 Yc(a.data)||Nb(a.data)?lb(a,!0):"M 0 0"}}).attr("transform",n?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",yb).style("opacity",0).transition().duration(u).text(vd).style("opacity",function(a){return Yc(a.data)||
Nb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",ia(k.data.targets,"donut")?1:0);Ca&&(null!==e.event&&"zoom"===e.event.type&&K.extent(m.orgDomain()).update(),f&&(G.select(".x.axis").style("opacity",p?0:1).transition().duration(h?u:0).call(hb),K.empty()||K.extent(m.orgDomain()).update(),f=G.selectAll(".-bars").selectAll(".-bar").data(Zc),f.enter().append("path").attr("d",xb(d)).style("stroke","none").style("fill",function(a){return N(a.id)}).attr("class",Kc),f.style("opacity",Ta).transition().duration(u).attr("d",
xb(d)).style("opacity",1),f.exit().transition().duration(u).style("opacity",0).remove(),G.selectAll(".-line").style("opacity",Ta).transition().duration(u).attr("d",Fe).style("opacity",1)));l.selectAll(".selected-circles").filter(function(a){return sb(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(u).attr("cx",h?Ba:Aa).attr("cy",h?Aa:Ba);ba?(f=l.select(".event-rects").selectAll(".event-rect").data([0]),Ae(f.enter()),f.attr("x",0).attr("y",0).attr("width",r).attr("height",
xb(d)).style("opacity",1),f.exit().transition().duration(u).style("opacity",0).remove(),G.selectAll(".-line").style("opacity",Ta).transition().duration(u).attr("d",Ge).style("opacity",1)));l.selectAll(".selected-circles").filter(function(a){return sb(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(u).attr("cx",h?Ba:Aa).attr("cy",h?Aa:Ba);ba?(f=l.select(".event-rects").selectAll(".event-rect").data([0]),Ae(f.enter()),f.attr("x",0).attr("y",0).attr("width",r).attr("height",
s)):(Qb?(g=function(a,b){var c=Fc(b),d=b<gb()-1?k.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=Fc(b);return(m(a.x)+m(c?c:a.x-50))/2}):(g=X(),d=function(a){return m(a.x)-g/2}),f=Vd(),l.select(".event-rects").datum(f?f.values:[]),f=l.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),ze(f.enter()),f.attr("class",Lc).attr("x",h?0:d).attr("y",h?d:0).attr("width",h?r:g).attr("height",h?g:s),f.exit().remove());d=l.select(".regions").selectAll("rect.region").data(P);
d.enter().append("rect");d.attr("class",$d).attr("x",h?0:Pb).attr("y",h?Pb:t).attr("width",h?r:Ac).attr("height",h?Ac:s).style("fill-opacity",function(a){return q(a.opacity)?a.opacity:0.1});d.exit().transition().duration(u).style("fill-opacity",0).remove();Pa().forEach(function(a){Sb[a]=!0})}function Ge(){"mousemove"===e.event.sourceEvent.type&&F.altDomain?(m.domain(F.altDomain),F.scale(m).updateScaleExtent()):(ja&&m.orgDomain()[0]===T[0]&&m.domain([T[0]-1E-10,m.orgDomain()[1]]),x({withTransition:!1,
d.enter().append("rect");d.attr("class",$d).attr("x",h?0:Pb).attr("y",h?Pb:t).attr("width",h?r:Ac).attr("height",h?Ac:s).style("fill-opacity",function(a){return q(a.opacity)?a.opacity:0.1});d.exit().transition().duration(u).style("fill-opacity",0).remove();Pa().forEach(function(a){Sb[a]=!0})}function He(){"mousemove"===e.event.sourceEvent.type&&F.altDomain?(m.domain(F.altDomain),F.scale(m).updateScaleExtent()):(ja&&m.orgDomain()[0]===T[0]&&m.domain([T[0]-1E-10,m.orgDomain()[1]]),x({withTransition:!1,
withY:!1,withSubchart:!1}),"mousemove"===e.event.sourceEvent.type&&(fc=!0))}function xe(){function a(){b.forEach(function(a){a()})}var b=[];a.add=function(a){b.push(a)};return a}function ye(){ua();Y();K.scale(U);sa&&F.scale(m);n.attr("width",Ab).attr("height",va);n.select("#"+ac).select("rect").attr("width",r).attr("height",s);n.select("#xaxis-clip").select("rect").attr("width",W);n.select(".zoom-rect").attr("width",r).attr("height",s);l.select(".x.axis").attr("transform",L.x);l.select(".y2.axis").attr("transform",
L.y2);l.select(".chart-arcs").attr("transform",L.arc);Ca&&(G.attr("transform",L.context),G.select(".x.axis").attr("transform",L.subx));Ea&&(Da.attr("transform",L.legend),wb(k.data.targets,{withTransition:!1}));x({withTransition:!1,withUpdateXDomain:!0})}function jd(a){var b;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",Jc).style("fill",function(a){return N(a.id)}).style("stroke",
"none").style("cursor",function(a){return la(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",Ic).style("opacity",0).style("stroke",function(a){return N(a.id)});b.append("path").attr("class",Yd).style("opacity",function(){pd=+e.select(this).style("opacity");return 0}).style("fill",function(a){return N(a.id)});b.append("g").attr("class",
function(a){return"selected-circles selected-circles-"+a.id});b.append("g").attr("class",Wd).style("fill",function(a){return N(a.id)}).style("cursor",function(a){return la(a)?"pointer":null});a.forEach(function(a){l.selectAll(".selected-circles-"+a.id).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})});b=l.select(".chart-arcs").selectAll(".chart-arc").data(Mb(a)).enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id});b.append("path").attr("class",
Xd).style("opacity",0).style("fill",function(a){return N(a.data.id)}).style("cursor",function(a){return la(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){wc(a.data.id);ic(a.data.id)}).on("mouseout",function(a){Ob(a.data.id);jc()});b.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none");Ca&&(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",Jc).style("fill",function(a){return N(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",Ic).style("opacity",0).style("stroke",function(a){return N(a.id)}));Ea&&wb(a);n.selectAll(".target").transition().style("opacity",1)}function Xa(a,b){k.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}});k.data.targets=k.data.targets.concat(a);jd(k.data.targets);x({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});b()}function ic(a){var b=n.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 He(a){var b=n.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 jc(){n.selectAll(".legend-item").transition().duration(100).style("opacity",1)}function wb(a,b){var c=Pa(a),d,e=r/2-Ya*Object.keys(a).length/2,g;b=y(b)?{}:b;g=q(b.withTransition)?b.withTransition:!0;d=Da.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){Ie(a)}).on("mouseover",function(a){ic(a);k.focus(a)}).on("mouseout",
a.splice(d,1);break}});k.data.targets=k.data.targets.concat(a);jd(k.data.targets);x({withUpdateOrgXDomain:!0,withUpdateXDomain:!0});b()}function ic(a){var b=n.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 Ie(a){var b=n.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 jc(){n.selectAll(".legend-item").transition().duration(100).style("opacity",1)}function wb(a,b){var c=Pa(a),d,e=r/2-Ya*Object.keys(a).length/2,g;b=y(b)?{}:b;g=q(b.withTransition)?b.withTransition:!0;d=Da.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){Je(a)}).on("mouseover",function(a){ic(a);k.focus(a)}).on("mouseout",
function(){jc();k.revert()});d.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",-200).attr("y",function(){return oa/2-16}).attr("width",Ya).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return N(a)}).attr("x",-200).attr("y",function(){return oa/2-9}).attr("width",10).attr("height",10);d.append("text").text(function(a){return q(Na[a])?Na[a]:a}).style("pointer-events","none").attr("x",-200).attr("y",
function(){return oa/2});Da.selectAll("rect.legend-item-event").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+Ya*b});Da.selectAll("rect.legend-item-tile").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+Ya*b});Da.selectAll("text").data(c).transition().duration(g?250:0).attr("x",function(a,b){return e+Ya*b+14})}function Za(a){return q(a)?".target-"+a:".target"}function kc(a){return Gc(a.id)}function lc(a){return"data"in a&&Gc(a.data.id)}var k={data:{}},
qb={},da="_expanded_",ma="_selected_",hc="_included_",wa=g(["bindto"],"#chart"),ab=g(["size","width"],null),sc=g(["size","height"],null),bb=g(["padding","left"],null),db=g(["padding","right"],null),sa=g(["zoom","enabled"],!1),qd=g(["zoom","extent"],null),ve=g(["zoom","privileged"],!1),pe=g(["onenter"],function(){}),qe=g(["onleave"],function(){});if(!("data"in ea))throw Error("data is required in config");var qa=g(["data","x"],null),ba=g(["data","xs"],null),Ub=g(["data","x_format"],"%Y-%m-%d"),Ud=
g(["data","id_converter"],function(a){return a}),Na=g(["data","names"],{}),w=g(["data","groups"],[]),vc=g(["data","axes"],{}),Ec=g(["data","type"],null),A=g(["data","types"],{}),rd=g(["data","regions"],{}),Je=g(["data","colors"],{}),ka=g(["data","selection","enabled"],!1),ta=g(["data","selection","grouped"],!1),la=g(["data","selection","isselectable"],function(){return!0}),Ca=g(["subchart","show"],!1),Bb=Ca?g(["subchart","size","height"],60):0,Ke=g(["color","pattern"],null),Ea=g(["legend","show"],
!0),Ya=g(["legend","item","width"],80),Ie=g(["legend","item","onclick"],function(){}),sd=g(["axis","x","type"],"indexed"),Ka=g(["axis","x","categories"],[]),Ad=g(["axis","x","tick","centered"],!1),mb=g(["axis","x","tick","format"],null),vb=g(["axis","x","default"],null),re=g(["axis","x","label"],null),Kd=g(["axis","y","max"],null),Id=g(["axis","y","min"],null),Md=g(["axis","y","center"],null),se=g(["axis","y","label"],null),cb=g(["axis","y","inner"],!1),me=g(["axis","y","tick","format"],function(a){return a}),
La=g(["axis","y","padding"],null),le=g(["axis","y","ticks"],10),Cb=g(["axis","y2","show"],!1),Jd=g(["axis","y2","max"],null),Hd=g(["axis","y2","min"],null),Ld=g(["axis","y2","center"],null),eb=g(["axis","y2","inner"],!1),oe=g(["axis","y2","tick","format"],function(a){return a}),Ma=g(["axis","y2","padding"],null),ne=g(["axis","y2","ticks"],10),h=g(["axis","rotated"],!1),hd=g(["grid","x","show"],!1),Ce=g(["grid","x","type"],"tick"),bc=g(["grid","x","lines"],null),id=g(["grid","y","show"],!1),cc=g(["grid",
"y","lines"],null),Zb=g(["point","show"],!0)?g(["point","r"],2.5):0,te=g(["point","focus","line","enabled"],!0),dc=g(["point","focus","expand","enabled"],!0),ec=g(["point","focus","expand","r"],dc?4:Zb),Ua=g(["point","focus","select","r"],8),Be=g(["point","onclick"],function(){}),he=g(["point","onselected"],function(){}),ie=g(["point","onunselected"],function(){}),Dd=g(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),ue=g(["arc","title"],""),P=g(["regions"],[]),Tc=g(["tooltip",
"enabled"],!0),Uc=g(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+pc()(a[0].x)+"</th></tr>",c,d,e;for(c=0;c<a.length;c++)a[c]&&(a[c].value||0===a[c].value)&&(d=q(a[c].value)?(Math.round(100*a[c].value)/100).toFixed(2):"-",e=a[c].name,b+="<tr class='-tooltip-name-"+a[c].id+"'><td class='name'><span style='background-color:"+N(a[c].id)+"'></span>"+e+"</td><td class='value'>"+d+"</td></tr>");return b+"</table>"}),we=g(["tooltip","init","show"],!1),Fa=g(["tooltip",
"init","x"],0),kd=g(["tooltip","init","position"],{top:"0px",left:"50px"}),ac=wa.replace("#","")+"-clip",Va="url(#"+ac+")",D="timeseries"===sd,ja="categorized"===sd,Qb=!D&&(qa||ba),gc=null,Wa=!1,fc=!1,oa=Ea?40:0,N=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]}}(Je,Ke),Bd=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)}}(),r,Db,s,fb,Ab,va,Ja,Eb,Fb,lb,tc,uc,Mb,Gb,Hb,Ib,Jb,Kb,Lb,m,z,aa,U,ib,jb,J,ya,kb,hb,wd=h?"left":"bottom",xd=h?cb?"top":"bottom":cb?"right":"left",yd=h?eb?"bottom":"top":eb?"left":"right",zd=h?"left":"bottom",L={main:function(){return"translate("+C+","+t+")"},context:function(){return"translate("+Ha+","+Ga+")"},legend:function(){return"translate("+nc+","+mc+")"},y2:function(){return"translate("+(h?0:r)+","+(h?10:0)+")"},x:function(){return"translate(0,"+s+")"},
subx:function(){return"translate(0,"+(h?0:fb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},rc=40,qc=20;Mb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var De=function(){var a=e.svg.line().x(h?function(a){return v(a.id)(a.value)}:za).y(h?za:function(a){return v(a.id)(a.value)});return function(b){var c=Wb(b.values),d;if(Tb(b))return Xc(b)?a.interpolate("cardinal"):a.interpolate("linear"),rd[b.id]?ke(c,m,v(b.id),rd[b.id]):a(c);d=m(c[0].x);
b=v(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Ee=function(){var a;a=h?e.svg.area().x0(function(a){return v(a.id)(0)}).x1(function(a){return v(a.id)(a.value)}).y(za):e.svg.area().x(za).y0(function(a){return v(a.id)(0)}).y1(function(a){return v(a.id)(a.value)});return function(b){var c=Wb(b.values),d;if(ia([b],"area")||ia([b],"area-spline"))return Xc(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=v(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),xb=function(a,
b){var c=a.__max__+1,d=1<arguments.length?b:!0,e=ja?c?1.2*J.tickOffset()/c:0:0.6*((h?s:r)*(d?1:xa(T)/xa(m.domain()))/(gb()-1)),g=ce(e,c,a,!!d),k=de(!!d),l=ee(a,!!d),n=d?B:v;return function(a,b){var c=n(a.id)(0),d=l(a,b)||c,c=[[g(a),d],[g(a),k(a)-(c-d)],[g(a)+e,k(a)-(c-d)],[g(a)+e,d]],d=h?1:0,m=h?0:1;return"M "+c[0][d]+","+c[0][m]+" L"+c[1][d]+","+c[1][m]+" L"+c[2][d]+","+c[2][m]+" L"+c[3][d]+","+c[3][m]+" z"}},Fe=function(){var a=e.svg.line().x(h?function(a){return B(a.id)(a.value)}:Nc).y(h?Nc:function(a){return B(a.id)(a.value)});
return function(b){var c=Wb(b.values);return Tb(b)?a(c):"M "+U(c[0].x)+" "+B(b.id)(c[0].value)}}(),K=e.svg.brush().on("brush",function(){x({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),F=e.behavior.zoom().on("zoomstart",function(){F.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",sa?Ge:null);K.update=function(){G&&G.select(".x.brush").call(this);return this};K.scale=function(a){return h?this.y(a):this.x(a)};F.scale=function(a){return h?this.y(a):this.x(a)};
qb={},da="_expanded_",ma="_selected_",hc="_included_",wa=g(["bindto"],"#chart"),ab=g(["size","width"],null),sc=g(["size","height"],null),bb=g(["padding","left"],null),db=g(["padding","right"],null),sa=g(["zoom","enabled"],!1),qd=g(["zoom","extent"],null),ve=g(["zoom","privileged"],!1),pe=g(["onenter"],function(){}),qe=g(["onleave"],function(){}),Ce=g(["transition","duration"],350);if(!("data"in ea))throw Error("data is required in config");var qa=g(["data","x"],null),ba=g(["data","xs"],null),Ub=g(["data",
"x_format"],"%Y-%m-%d"),Ud=g(["data","id_converter"],function(a){return a}),Na=g(["data","names"],{}),w=g(["data","groups"],[]),vc=g(["data","axes"],{}),Ec=g(["data","type"],null),A=g(["data","types"],{}),rd=g(["data","regions"],{}),Ke=g(["data","colors"],{}),ka=g(["data","selection","enabled"],!1),ta=g(["data","selection","grouped"],!1),la=g(["data","selection","isselectable"],function(){return!0}),Ca=g(["subchart","show"],!1),Bb=Ca?g(["subchart","size","height"],60):0,Le=g(["color","pattern"],null),
Ea=g(["legend","show"],!0),Ya=g(["legend","item","width"],80),Je=g(["legend","item","onclick"],function(){}),sd=g(["axis","x","type"],"indexed"),Ka=g(["axis","x","categories"],[]),Ad=g(["axis","x","tick","centered"],!1),mb=g(["axis","x","tick","format"],null),vb=g(["axis","x","default"],null),re=g(["axis","x","label"],null),Kd=g(["axis","y","max"],null),Id=g(["axis","y","min"],null),Md=g(["axis","y","center"],null),se=g(["axis","y","label"],null),cb=g(["axis","y","inner"],!1),me=g(["axis","y","tick",
"format"],function(a){return a}),La=g(["axis","y","padding"],null),le=g(["axis","y","ticks"],10),Cb=g(["axis","y2","show"],!1),Jd=g(["axis","y2","max"],null),Hd=g(["axis","y2","min"],null),Ld=g(["axis","y2","center"],null),eb=g(["axis","y2","inner"],!1),oe=g(["axis","y2","tick","format"],function(a){return a}),Ma=g(["axis","y2","padding"],null),ne=g(["axis","y2","ticks"],10),h=g(["axis","rotated"],!1),hd=g(["grid","x","show"],!1),De=g(["grid","x","type"],"tick"),bc=g(["grid","x","lines"],null),id=
g(["grid","y","show"],!1),cc=g(["grid","y","lines"],null),Zb=g(["point","show"],!0)?g(["point","r"],2.5):0,te=g(["point","focus","line","enabled"],!0),dc=g(["point","focus","expand","enabled"],!0),ec=g(["point","focus","expand","r"],dc?4:Zb),Ua=g(["point","focus","select","r"],8),Be=g(["point","onclick"],function(){}),he=g(["point","onselected"],function(){}),ie=g(["point","onunselected"],function(){}),Dd=g(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),ue=g(["arc","title"],
""),P=g(["regions"],[]),Tc=g(["tooltip","enabled"],!0),Uc=g(["tooltip","contents"],function(a){var b="<table class='-tooltip'><tr><th colspan='2'>"+pc()(a[0].x)+"</th></tr>",c,d,e;for(c=0;c<a.length;c++)a[c]&&(a[c].value||0===a[c].value)&&(d=q(a[c].value)?(Math.round(100*a[c].value)/100).toFixed(2):"-",e=a[c].name,b+="<tr class='-tooltip-name-"+a[c].id+"'><td class='name'><span style='background-color:"+N(a[c].id)+"'></span>"+e+"</td><td class='value'>"+d+"</td></tr>");return b+"</table>"}),we=g(["tooltip",
"init","show"],!1),Fa=g(["tooltip","init","x"],0),kd=g(["tooltip","init","position"],{top:"0px",left:"50px"}),ac=wa.replace("#","")+"-clip",Va="url(#"+ac+")",D="timeseries"===sd,ja="categorized"===sd,Qb=!D&&(qa||ba),gc=null,Wa=!1,fc=!1,oa=Ea?40:0,N=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]}}(Ke,Le),Bd=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)}}(),r,Db,s,fb,Ab,va,Ja,Eb,Fb,lb,tc,uc,Mb,Gb,Hb,Ib,Jb,Kb,Lb,m,z,aa,U,ib,jb,J,ya,kb,hb,wd=h?"left":"bottom",xd=h?cb?"top":"bottom":cb?"right":"left",yd=h?eb?"bottom":"top":eb?"left":"right",zd=h?"left":"bottom",L={main:function(){return"translate("+C+","+t+")"},context:function(){return"translate("+Ha+","+Ga+")"},legend:function(){return"translate("+nc+","+mc+")"},y2:function(){return"translate("+(h?0:r)+","+(h?10:0)+")"},x:function(){return"translate(0,"+
s+")"},subx:function(){return"translate(0,"+(h?0:fb)+")"},arc:function(){return"translate("+r/2+","+s/2+")"}},rc=40,qc=20;Mb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var Ee=function(){var a=e.svg.line().x(h?function(a){return v(a.id)(a.value)}:za).y(h?za:function(a){return v(a.id)(a.value)});return function(b){var c=Wb(b.values),d;if(Tb(b))return Xc(b)?a.interpolate("cardinal"):a.interpolate("linear"),rd[b.id]?ke(c,m,v(b.id),rd[b.id]):a(c);d=m(c[0].x);
b=v(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Fe=function(){var a;a=h?e.svg.area().x0(function(a){return v(a.id)(0)}).x1(function(a){return v(a.id)(a.value)}).y(za):e.svg.area().x(za).y0(function(a){return v(a.id)(0)}).y1(function(a){return v(a.id)(a.value)});return function(b){var c=Wb(b.values),d;if(ia([b],"area")||ia([b],"area-spline"))return Xc(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=v(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),xb=function(a,
b){var c=a.__max__+1,d=1<arguments.length?b:!0,e=ja?c?1.2*J.tickOffset()/c:0:0.6*((h?s:r)*(d?1:xa(T)/xa(m.domain()))/(gb()-1)),g=ce(e,c,a,!!d),k=de(!!d),l=ee(a,!!d),n=d?B:v;return function(a,b){var c=n(a.id)(0),d=l(a,b)||c,c=[[g(a),d],[g(a),k(a)-(c-d)],[g(a)+e,k(a)-(c-d)],[g(a)+e,d]],d=h?1:0,m=h?0:1;return"M "+c[0][d]+","+c[0][m]+" L"+c[1][d]+","+c[1][m]+" L"+c[2][d]+","+c[2][m]+" L"+c[3][d]+","+c[3][m]+" z"}},Ge=function(){var a=e.svg.line().x(h?function(a){return B(a.id)(a.value)}:Nc).y(h?Nc:function(a){return B(a.id)(a.value)});
return function(b){var c=Wb(b.values);return Tb(b)?a(c):"M "+U(c[0].x)+" "+B(b.id)(c[0].value)}}(),K=e.svg.brush().on("brush",function(){x({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}),F=e.behavior.zoom().on("zoomstart",function(){F.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",sa?He:null);K.update=function(){G&&G.select(".x.brush").call(this);return this};K.scale=function(a){return h?this.y(a):this.x(a)};F.scale=function(a){return h?this.y(a):this.x(a)};
F.orgScaleExtent=function(){var a=qd?qd:[1,10];return[a[0],Math.max(gb()/a[1],a[1])]};F.updateScaleExtent=function(){var a=xa(m.orgDomain())/xa(T),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this};var n,ub,l,G,Da,V,tb,T,pd,Sb={};k.focus=function(a){var b=n.selectAll(Za(a)),c=b.filter(kc),b=b.filter(lc);k.revert();k.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);E(k.data.targets)&&wc(a,!0);ic(a)};
k.defocus=function(a){var b=n.selectAll(Za(a)),c=b.filter(kc),b=b.filter(lc);k.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);E(k.data.targets)&&Ob(a);He(a)};k.revert=function(a){var b=n.selectAll(Za(a)),c=b.filter(kc),b=b.filter(lc);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);E(k.data.targets)&&Ob(a);jc()};k.show=function(a){n.selectAll(Za(a)).transition().style("opacity",
k.defocus=function(a){var b=n.selectAll(Za(a)),c=b.filter(kc),b=b.filter(lc);k.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);E(k.data.targets)&&Ob(a);Ie(a)};k.revert=function(a){var b=n.selectAll(Za(a)),c=b.filter(kc),b=b.filter(lc);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);E(k.data.targets)&&Ob(a);jc()};k.show=function(a){n.selectAll(Za(a)).transition().style("opacity",
1)};k.hide=function(a){n.selectAll(Za(a)).transition().style("opacity",0)};k.unzoom=function(){K.clear().update();x({withUpdateXDomain:!0})};k.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&Td(a.xs);"categories"in a&&ja&&(Ka=a.categories,J.categories(Ka));if("cacheIds"in a&&Pd(a.cacheIds))Xa(Qd(a.cacheIds),a.done);else if("data"in a)Xa(Oa(a.data),a.done);else if("url"in a)e.csv(a.url,function(b,c){Xa(Oa(c),a.done)});else if("rows"in a)Xa(Oa(Cc(a.rows)),a.done);else if("columns"in
a)Xa(Oa(Dc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};k.unload=function(a){k.data.targets=k.data.targets.filter(function(b){return b.id!==a});n.selectAll(".target-"+a).transition().style("opacity",0).remove();Ea&&(n.selectAll(".legend-item-"+a).remove(),wb(k.data.targets));0<k.data.targets.length&&x({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})};k.selected=function(a){a=q(a)?"-"+a:"";return e.merge(l.selectAll(".-shapes"+a).selectAll(".-shape").filter(function(){return e.select(this).classed(ma)}).map(function(a){return a.map(function(a){return a.__data__})}))};
k.select=function(a,b,c){ka&&l.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var g="circle"===this.nodeName?bd:je,h="circle"===this.nodeName?Vb:dd;0<=b.indexOf(f)?la(d)&&(ta||y(a)||0<=a.indexOf(d.id))&&g(e.select(this).classed(ma,!0),d,f):q(c)&&c&&h(e.select(this).classed(ma,!1),d,f)})};k.unselect=function(a,b){ka&&l.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var f="circle"===this.nodeName?Vb:dd;(y(b)||0<=b.indexOf(d))&&la(c)&&(ta||y(a)||0<=a.indexOf(c.id))&&f(e.select(this).classed(ma,

Loading…
Cancel
Save