watchTransition() is not a function in nv.d3.js with angular.js

六眼飞鱼酱① 提交于 2019-12-11 04:28:14

问题


I am trying to render a boxplot from nv.d3.js. v.1.8.5 and d3.js v.3.4.4 . I am adding the d3.js file before nv.d3.js file from the index.html .The code breaks saying boxplots.watchTransition is not a function

The following is my code

d3.selection.prototype.watchTransition = function(renderWatch){
    var args = [this].concat([].slice.call(arguments, 1));
    return renderWatch.transition.apply(renderWatch, args);
};

And later in the code

boxplots.watchTransition(renderWatch, 'nv-boxplot: boxplots')
                .style('stroke-opacity', 1)
                .style('fill-opacity', 0.75)
                .delay(function(d,i) { return i * duration / data.length })
                .attr('transform', function(d,i) {
                    return 'translate(' + (xScale(getX(d,i)) + xScale.rangeBand() * 0.05) + ', 0)';
                });

回答1:


Upgrading npm to latest version worked for me.

Use following command to upgrade npm npm i -g npm



来源:https://stackoverflow.com/questions/41103056/watchtransition-is-not-a-function-in-nv-d3-js-with-angular-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!