小编Jen*_*nna的帖子

使用`d3.legend` 的错误:未捕获的类型错误:node.getAttribute 不是函数

我正在尝试向我的圆环图添加 D3 图例,我按照这里的示例进行操作:http : //bl.ocks.org/ZJONSSON/3918369。圆环图呈现良好。

但是,我遇到了以下错误:

在 d3.legend() 函数中,我收到此错误“Uncaught TypeError: node.getAttribute is not a function”和“Uncaught TypeError: this.querySelectorAll is not a function”。

我不知道为什么......有什么想法吗?

// Alerts.js
renderBody() {
    const {list, currentProgram} = this.props
    const width = 260;
    const height = 260;
    const radius = width/2; // 130

    // arc & label generator
    let arc = d3.arc()
      .outerRadius(radius - 10)
      .innerRadius(90)
      .padAngle(0.02);

    let labelArc = d3.arc()
      .outerRadius(radius + 60)
      .innerRadius(radius - 90);

    // pie generator
    let pie = d3.pie()
      .sort(null)
      .value( …
Run Code Online (Sandbox Code Playgroud)

charts legend node.js d3.js reactjs

1
推荐指数
1
解决办法
1994
查看次数

标签 统计

charts ×1

d3.js ×1

legend ×1

node.js ×1

reactjs ×1