watchTransition()在带有angular.js的nv.d3.js中不是函数 [英] watchTransition() is not a function in nv.d3.js with angular.js

查看:139
本文介绍了watchTransition()在带有angular.js的nv.d3.js中不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从nv.d3.js渲染箱形图. v.1.8.5和d3.js v.3.4.4.我正在从index.html的nv.d3.js文件之前添加d3.js文件.代码中断说boxplots.watchTransition is not a function

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

以下是我的代码

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

然后在代码中

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)';
                });

推荐答案

将npm升级到最新版本对我有用.

Upgrading npm to latest version worked for me.

使用以下命令升级npm npm i -g npm

Use following command to upgrade npm npm i -g npm

这篇关于watchTransition()在带有angular.js的nv.d3.js中不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆