【问题标题】:watchTransition() is not a function in nv.d3.js with angular.jswatchTransition() 不是带有 angular.js 的 nv.d3.js 中的函数
【发布时间】:2016-12-12 14:27:30
【问题描述】:

我正在尝试从 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

以下是我的代码

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

【问题讨论】:

    标签: angularjs d3.js nvd3.js boxplot


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-06
      • 2015-08-03
      • 2016-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-02
      • 1970-01-01
      相关资源
      最近更新 更多