Browse Source

Remove transition when y grid updated

pull/18/head
Masayuki Tanaka 11 years ago
parent
commit
20007e6017
  1. 5
      c3.js
  2. 8
      c3.min.js

5
c3.js

@ -1471,10 +1471,7 @@
ygrid.attr("x1", __axis_rotated ? y : 0)
.attr("x2", __axis_rotated ? y : width)
.attr("y1", __axis_rotated ? 0 : y)
.attr("y2", __axis_rotated ? height : y)
.attr("opacity", 0)
.transition()
.attr("opacity", 1);
.attr("y2", __axis_rotated ? height : y);
ygrid.exit().remove();
}
if (withY && __grid_y_lines) {

8
c3.min.js vendored

@ -35,10 +35,10 @@ s=1*c.attr("width"),m=kc,h=f<h+s&&h<g&&p<n);h^k&&(c.classed(Db,!k),c.classed(ia,
ma),x.append("g").attr("class","x axis").attr("transform",K.subx).call(Da));ya&&gb(g.data.targets);rc(g.data.targets);B({withTransition:!1,withUpdateXDomain:!0});if(id){if(z&&"string"===typeof za){za=oa(za);for(a=0;a<g.data.targets[0].values.length&&0!==g.data.targets[0].values[a].x-za;a++);za=a}X.html(qc(g.data.targets.map(function(a){return nb(a.values[za])})));X.style("top",sc.top).style("left",sc.left).style("display","block")}null==O.onresize&&(O.onresize=jd)}}function B(a){var b,c,e=Rc(),p=
e.__max__+1,m,s,t,w,v;a=n(a)?a:{};b=n(a.withY)?a.withY:!0;w=n(a.withSubchart)?a.withSubchart:!0;v=n(a.withTransition)?a.withTransition:!0;a=n(a.withUpdateXDomain)?a.withUpdateXDomain:!1;v=v?250:0;a&&(l.domain(F.empty()?U:F.extent()),pa&&G.x(l).updateScaleExtent());y.domain(ka("y"));T.domain(ka("y2"));h.select(".x.axis").transition().duration(f?v:0).call(f?na:J);h.select(".y.axis").transition().duration(f?0:v).call(f?J:na);h.select(".y2.axis").transition().call(Ya);h.select(".x.axis .-axis-x-label").attr("x",
r);Wa.domain(y.domain());Xa.domain(T.domain());X.style("display","none");h.select("line.xgrid-focus").style("visibility","hidden").attr("y2",u);if(mc){if("year"===kd)for(a=[],s=bb.getFullYear(),m=pb.getFullYear();s<=m;s++)a.push(new Date(s+"-01-01 00:00:00"));else a=l.ticks(10);a=h.select(".xgrids").selectAll(".xgrid").data(a);a.enter().append("line").attr("class","xgrid");a.exit().remove();h.selectAll(".xgrid").attr("x1",function(a){return l(a)-J.tickOffset()}).attr("x2",function(a){return l(a)-
J.tickOffset()}).attr("y1",q).attr("y2",u)}yb&&(a=h.selectAll(".xgrid-lines"),a.selectAll("line").attr("x1",f?0:Ka).attr("x2",f?r:Ka).attr("y1",f?Ka:q).attr("y2",f?Ka:u),a.selectAll("text").attr("x",f?r:0).attr("y",Ka));b&&nc&&(a=h.select(".ygrids").selectAll(".ygrid").data(y.ticks(10)),a.enter().append("line").attr("class","ygrid"),a.attr("x1",f?y:0).attr("x2",f?y:r).attr("y1",f?0:y).attr("y2",f?u:y).attr("opacity",0).transition().attr("opacity",1),a.exit().remove());b&&zb&&h.select(".ygrid-lines").selectAll(".ygrid-line").attr("y1",
ac).attr("y2",ac);m=ca?1.2*J.tickOffset()/p:0.6*((f?u:r)*$(!1)/(va()-1));s=dc(f?null:u);b=bc(m,p,e);a=cc(s,e,f);c=h.selectAll(".-bars").selectAll(".-bar").data(ec);c.transition().duration(v).attr("x",f?a:b).attr("y",f?b:a).attr("width",f?s:m).attr("height",f?m:s);c.enter().append("rect").attr("class",$b).attr("x",f?a:b).attr("y",f?b:a).attr("width",f?s:m).attr("height",f?m:s).style("opacity",0).transition().duration(v).style("opacity",1);c.exit().transition().duration(v).style("opacity",0).remove();
h.selectAll(".-line").transition().duration(v).attr("d",ld);b=h.selectAll(".-circles").selectAll(".-circle").data(Sc);b.transition().duration(v).style("opacity",function(a){return null===a.value?0:1}).attr("cx",f?ea:da).attr("cy",f?da:ea);b.enter().append("circle").style("opacity",function(a){return null===a.value?0:1}).attr("class",Pc).attr("cx",f?ea:da).attr("cy",f?da:ea).attr("r",Ab);b.exit().remove();wa&&(null!==d.event&&"zoom"===d.event.type&&F.extent(l.orgDomain()).update(),w&&(x.select(".x.axis").transition().duration(f?
v:0).call(f?na:Da),F.empty()||F.extent(l.orgDomain()).update(),m=ca?1.2*Da.tickOffset()/p:0.6*((f?u:r)*$(!0)/(va()-1)),s=dc(ma,!0),b=bc(m,p,e,!0),a=cc(s,e,!1,!0),e=x.selectAll(".-bars").selectAll(".-bar").data(ec),e.transition().duration(v).attr("x",b).attr("y",a).attr("width",m).attr("height",s),e.enter().append("rect").attr("class",$b).attr("x",b).attr("y",a).attr("width",m).attr("height",s).style("opacity",0).transition().style("opacity",1),e.exit().transition().style("opacity",0).remove(),x.selectAll(".-line").transition().duration(v).attr("d",
J.tickOffset()}).attr("y1",q).attr("y2",u)}yb&&(a=h.selectAll(".xgrid-lines"),a.selectAll("line").attr("x1",f?0:Ka).attr("x2",f?r:Ka).attr("y1",f?Ka:q).attr("y2",f?Ka:u),a.selectAll("text").attr("x",f?r:0).attr("y",Ka));b&&nc&&(a=h.select(".ygrids").selectAll(".ygrid").data(y.ticks(10)),a.enter().append("line").attr("class","ygrid"),a.attr("x1",f?y:0).attr("x2",f?y:r).attr("y1",f?0:y).attr("y2",f?u:y),a.exit().remove());b&&zb&&h.select(".ygrid-lines").selectAll(".ygrid-line").attr("y1",ac).attr("y2",
ac);m=ca?1.2*J.tickOffset()/p:0.6*((f?u:r)*$(!1)/(va()-1));s=dc(f?null:u);b=bc(m,p,e);a=cc(s,e,f);c=h.selectAll(".-bars").selectAll(".-bar").data(ec);c.transition().duration(v).attr("x",f?a:b).attr("y",f?b:a).attr("width",f?s:m).attr("height",f?m:s);c.enter().append("rect").attr("class",$b).attr("x",f?a:b).attr("y",f?b:a).attr("width",f?s:m).attr("height",f?m:s).style("opacity",0).transition().duration(v).style("opacity",1);c.exit().transition().duration(v).style("opacity",0).remove();h.selectAll(".-line").transition().duration(v).attr("d",
ld);b=h.selectAll(".-circles").selectAll(".-circle").data(Sc);b.transition().duration(v).style("opacity",function(a){return null===a.value?0:1}).attr("cx",f?ea:da).attr("cy",f?da:ea);b.enter().append("circle").style("opacity",function(a){return null===a.value?0:1}).attr("class",Pc).attr("cx",f?ea:da).attr("cy",f?da:ea).attr("r",Ab);b.exit().remove();wa&&(null!==d.event&&"zoom"===d.event.type&&F.extent(l.orgDomain()).update(),w&&(x.select(".x.axis").transition().duration(f?v:0).call(f?na:Da),F.empty()||
F.extent(l.orgDomain()).update(),m=ca?1.2*Da.tickOffset()/p:0.6*((f?u:r)*$(!0)/(va()-1)),s=dc(ma,!0),b=bc(m,p,e,!0),a=cc(s,e,!1,!0),e=x.selectAll(".-bars").selectAll(".-bar").data(ec),e.transition().duration(v).attr("x",b).attr("y",a).attr("width",m).attr("height",s),e.enter().append("rect").attr("class",$b).attr("x",b).attr("y",a).attr("width",m).attr("height",s).style("opacity",0).transition().style("opacity",1),e.exit().transition().style("opacity",0).remove(),x.selectAll(".-line").transition().duration(v).attr("d",
md)));h.selectAll(".selected-circles").filter(function(a){return Fa(a)}).selectAll("circle").remove();h.selectAll(".selected-circle").transition().duration(v).attr("cx",f?ea:da).attr("cy",f?da:ea);ob?(t=function(a,b){var c=0<b?g.data.targets[0].values[b-1].x:void 0,d=b<va()-1?g.data.targets[0].values[b+1].x:void 0;return(l(d?d:a.x+50)-l(c?c:a.x-50))/2},e=function(a,b){var c=0<b?g.data.targets[0].values[b-1].x:void 0;return(l(a.x)+l(c?c:a.x-50))/2}):(t=(f?u:r)*$()/(va()-1),e=function(a){return l(a.x)-
t/2});h.selectAll(".event-rect").attr("x",f?0:e).attr("y",f?e:0).attr("width",f?r:t).attr("height",f?t:u);e=h.select(".regions").selectAll("rect.region").data(L);e.enter().append("rect");e.attr("class",Qc).attr("x",f?0:Ca).attr("y",f?Ca:q).attr("width",f?r:Hb).attr("height",f?Hb:u).style("fill-opacity",function(a){return n(a.opacity)?a.opacity:0.1});e.exit().transition().duration(v).style("fill-opacity",0).remove()}function nd(){"mousemove"===d.event.sourceEvent.type&&G.altDomain?(l.domain(G.altDomain),
G.x(l).updateScaleExtent()):(ca&&l.orgDomain()[0]===U[0]&&l.domain([U[0]-1E-10,l.orgDomain()[1]]),B({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===d.event.sourceEvent.type&&(Bb=!0))}function jd(){sa();Eb();F.x(ba);pa&&G.x(l);d.select("svg").attr("width",ib).attr("height",ta);d.select("#"+xb).select("rect").attr("width",r).attr("height",u);d.select("#xaxis-clip").select("rect").attr("width",Q);d.select(".zoom-rect").attr("width",r).attr("height",u);h.select(".x.axis").attr("transform",

Loading…
Cancel
Save