简体   繁体   English

d3中实时图形不平滑的转换

[英]d3 transition of realtime graph unsmooth in ie

I'm using the super-cool d3.js by Mike Bostock & team and have just implemented my own version of a sliding time-series chart as shown on Mike's page (the second version). 我正在使用Mike Bostock和团队的超酷d3.js,并且刚刚实现了我自己版本的滑动时间序列图表,如Mike的页面 (第二版)所示。

Unfortunatly, the sliding effect (even that of Mike's version) is crappy in Internet Explorer (versions < 11), while it's totally smooth in eg Firefox. 不幸的是,滑动效果(即使是迈克的版本)在Internet Explorer(版本<11)中也很糟糕,而在Firefox中则非常流畅。 The continously sliding effect is achieved by recoursivly calling the tick() function and that's the point where IE seems to have a problem. 通过recoursivly调用tick()函数来实现连续滑动效果,这就是IE似乎有问题的地方。

What makes me think that there might be some solution to this is that the very first transition is smooth even in IE. 是什么让我觉得可能有一些解决方案是即使在IE中,第一次转换也很顺利。

I've tried using setInterval as an alternative but to no success. 我尝试使用setInterval作为替代方案,但没有成功。 Can anybody think of a solution (other than to stop using ie..)? 任何人都可以想到一个解决方案(除了停止使用ie ...)?

Replace .attr("transform", null) with .attr("transform", "") . .attr("transform", "")替换.attr("transform", null) .attr("transform", "")

For example: 例如:

path
    .attr("d", line)
    // ******************************
    .attr("transform", "") // <- here 
    // ******************************
    .transition()
      .duration(750)
      .ease("linear")
      .attr("transform", "translate(" + x(-1) + ")")
      .each("end", function() { tick(path, line, data, x); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM