dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.86k stars 592 forks source link

how to use dagre-d3 in Vue? #400

Open zhangxiaodong1209 opened 4 years ago

zhangxiaodong1209 commented 4 years ago

like issues/320:


"dependencies": { "dagre-d3": "^0.6.4",

import * as d3 from 'd3'; import dagreD3 from 'dagre-d3/dist/dagre-d3'; ---------------demo code -------------- // Create a new directed graph var g = new dagreD3.graphlib.Graph().setGraph({}); g.setNode("root", { ....

npm run dev then but i got errors like below:

TypeError: Cannot read property 'getBBox' of undefined at getCoords (create-edge-paths.js?0c4b:95) at eval (create-edge-paths.js?0c4b:113) at Array.map () at SVGPathElement.eval (create-edge-paths.js?0c4b:113) at SVGPathElement.eval (attr.js?b110:29) at Selection.eval [as each] (each.js?d34e:5) at Selection.eval [as attr] (attr.js?b110:53) at enter (create-edge-paths.js?0c4b:110) at createEdgePaths (create-edge-paths.js?0c4b:14) at fn (render.js?8e5e:31)

what can i do ? thank u !

smetroid commented 4 years ago

you may also need d3 in your node js dependency, just in case anyone else runs into the same problem.