2016-12-12 28 views
1

我试图呈现从nv.d3.js.箱线图功能v.1.8.5和d3.js v.3.4.4。我加入d3.js文件在index.html .The代码休息nv.d3.js文件之前说boxplots.watchTransition is not a functionwatchTransition()不nv.d3.js与angular.js

以下是我的代码

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

回答

0

升级NPM到最新版本为我工作。

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