Node.js d3.js v3到v4错误-动画和文本上下文

Node.js d3.js v3到v4错误-动画和文本上下文,node.js,reactjs,d3.js,Node.js,Reactjs,D3.js,我正在将图表应用程序从v3重构到v4 “TypeError:callback.call不是函数” 下面是代码——但我不确定这为什么会导致callback.call错误 waveGroup.attr('transform','translate('+waveGroupXPosition+','+waveRiseScale(0)+')') 我相信这是动画代码的问题 // Data for building the clip wave area.

我正在将图表应用程序从v3重构到v4

  • “TypeError:callback.call不是函数”
  • 下面是代码——但我不确定这为什么会导致callback.call错误

    waveGroup.attr('transform','translate('+waveGroupXPosition+','+waveRiseScale(0)+')')
    


    我相信这是动画代码的问题

                // Data for building the clip wave area.
                var data = [];
                for(var i = 0; i <= 40*waveClipCount; i++){
                    data.push({x: i/(40*waveClipCount), y: (i/(40))});
                }
    var clipArea = d3.area()
    
            var wave = waveGroup.append("path")
                .datum(data)
                .attr("d", clipArea)
                .attr("T", 0);
    
    
            function animateWave() {
                wave.attr('transform','translate('+waveAnimateScale(wave.attr('T'))+',0)');
    
                wave.transition()
                    .duration(config.waveAnimateTime * (1-wave.attr('T')))
                    .ease('linear')
                    .attr('transform','translate('+waveAnimateScale(1)+',0)')
                    .attr('T', 1)
                    .each('end', function(){
                        wave.attr('T', 0);
                        animateWave(config.waveAnimateTime);
                    });
            }
    

    缓和功能已更改?

    我看不出这行代码有任何错误,但我想知道错误是否与
    波组的值有关。在d3中,有时很容易混淆哪些方法返回选择,哪些不返回选择。我的猜测是
    waveGroup
    在运行时没有引用选择

    function repeat() {
      timeCircle
        .attr('cx', 210)          // position the circle at 40 on the x axis
        .attr('cy', (yPos*45)+25) // position the circle at 250 on the y axis
        .transition()             // apply a transition
        .ease(easement)           // control the speed of the transition
        .duration(4000)           // apply it over 2000 milliseconds
        .attr('cx', 720)          // move the circle to 920 on the x axis
        .transition()             // apply a transition
        .ease(easement)           // control the speed of the transition
        .duration(4000)           // apply it over 2000 milliseconds
        .attr('cx', 210)          // return the circle to 40 on the x axis
        .on("end", repeat);       // when the transition finishes start again
    };