小编Anj*_*jay的帖子

类型错误:无法读取 d3 中未定义的属性“选择”

我是 React 和 Dagre-D3 的新手。我将此 Dagre-D3演示转换为 React 组件。我使用的代码如下所示。

import React from 'react'
import d3 from 'd3'
import dagreD3 from 'dagre-d3'

export default class EventFlow extends React.Component {
    constructor () {
        super();
    }

    componentDidMount() {
        // Create the input graph
        var g = new dagreD3.graphlib.Graph()
          .setGraph({})
          .setDefaultEdgeLabel(function() { return {}; });

        // Here we"re setting nodeclass, which is used by our custom drawNodes function below.
        g.setNode(0,  { label: "TOP",       class: "type-TOP" });
        g.setNode(1,  { label: "S",         class: "type-S" }); …
Run Code Online (Sandbox Code Playgroud)

d3.js reactjs

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

标签 统计

d3.js ×1

reactjs ×1