diff --git a/c3.js b/c3.js index f5faffd..5eeee0f 100644 --- a/c3.js +++ b/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))); diff --git a/c3.min.js b/c3.min.js index 4b4dd69..deb009e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -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",c,d,e;for(c=0;c"+e+""+d+"");return b+""}),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",c,d,e;for(c=0;c"+e+""+d+"");return b+""}),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