D3.js:无法读取属性' getAttribute'在Selection.selection_attr [as attr]的null

时间:2016-11-04 07:10:53

标签: angularjs d3.js

我是D3.js的新手....我正在尝试按照一些示例代码实现示例图表....我正在使用d3版本4.3.0并且我收到以下错误

ionic.bundle.js:26799 TypeError: Cannot read property 'getAttribute' of null
at Selection.selection_attr [as attr] (d3.js:7705)
at redrawLineChart (controller.js:147)

当我查看错误链接时,它在我的控制器中显示此代码

function redrawLineChart() {

        setChartParameters();

        svg.selectAll("g.y.axis").call(yAxisGen);

        svg.selectAll("g.x.axis").call(xAxisGen);

        svg.selectAll("."+pathClass)
          .attr({
            d: lineFun(salesDataToPlot)**highlighting this**
          });
      }

并在D3.js中显示以下

var selection_attr = function(name, value) {
  var fullname = namespace(name);

  if (arguments.length < 2) {
    var node = this.node();
    return fullname.local
        ? node.getAttributeNS(fullname.space, fullname.local)
        : node.getAttribute(fullname);**highlighting this**
  }

  return this.each((value == null
      ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
      ? (fullname.local ? attrFunctionNS : attrFunction)
      : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
};

0 个答案:

没有答案