2016-12-12 24 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