2016-12-12 11 views
1

nv.d3.js에서 boxplot을 렌더링하려고합니다. v.1.8.5 및 d3.js v.3.4.4. 내가watchTransition()은 angular.js가있는 nv.d3.js의 함수가 아닙니다.

다음 boxplots.watchTransition is not a function을 말하는 index.html을 국지적 인 코드 나누기에서 nv.d3.js 파일 전에 d3.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