简体   繁体   中英

The "dagre" utility is a mandatory dependency

I am using jointjs and to auto layout the nodes I am using dagre library. my code break at this code

joint.layout.DirectedGraph.layout(self.graph, {
        setLinkVertices: false,
        rankDir: "LR",
        rankSep: 150,
        marginX: 100,
        marginY: 200,
        nodeSep: 80,
        edgeSep: 50
      }
      );

showing me Error: The the "dagre" utility is a mandatory dependency. I am using dagre@0.7.3 and jointjs@3.0.4,

I just ran into the same issue. The jointjs DirectedGraph plugin requires the dagre and graphlib packages.

To get around this I npm installed both dagre and graphlib.

So you would need to do this...

import dagre from 'dagre';
import graphlib from 'graphlib';
import * as joint from 'jointjs';

joint.layout.DirectedGraph.layout(self.graph, {
    dagre: dagre,
    graphlib: graphlib
    setLinkVertices: false,
    rankDir: "LR",
    rankSep: 150,
    marginX: 100,
    marginY: 200,
    nodeSep: 80,
    edgeSep: 50
  }
  );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM