第一个和最后一个元素之间的连续循

时间:2016-04-20 07:00:47

标签: javascript d3.js

如何在第一个和最后一个元素之间运行连续循环

以下是示例代码

 d3.selectAll('.radarArea').each(function (d, i) {
                   // add style to this element
                   // remove style to other than this element.
                   // if it is last then again start from first element 
                });

由于

1 个答案:

答案 0 :(得分:1)

来自d3的API旨在:https://github.com/d3/d3-transition#active

但它需要v4,但尚未完成,所以:

var radarAreas = d3.selectAll('.radarArea')
setInterval(function() {
  radarAreas.each(function (d, i) {
      // add style to this element
      // remove style to other than this element.
      // if it is last then again start from first element 
   });
}, time)