Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In node.js method getBBox is missing. #46

Closed
petrounias opened this issue May 27, 2014 · 4 comments
Closed

In node.js method getBBox is missing. #46

petrounias opened this issue May 27, 2014 · 4 comments

Comments

@petrounias
Copy link

Attempting to run the renderer in node.js results in the following error:

TypeError: Object [ G.node.enter ] has no method 'getBBox'

due to the following line in Renderer.js:

var bbox = root.node().getBBox();
@cpettitt
Copy link
Collaborator

What DOM are you using in node.js? If you are trying to run a layout algorithm without a DOM, dagre (versus dagre-d3) would be the way to go.

@petrounias
Copy link
Author

I am using jsdom. I have verified I can output SVG's just fine (e.g. adding a simple circle to the svg element, and so on) - it's only the missing getBBox method that's the problem.

@cpettitt
Copy link
Collaborator

Take a look at this comment from Mike Bostock (author of D3). He says that jsdom doesn't have proper SVG support and recommends using PhantomJS. I have personally used PhantomJS with dagre-d3 in the past. See https://github.com/cpettitt/dagre-d3-cli as a proof-of-concept example.

@petrounias
Copy link
Author

Can confirm that the renderer works with PhantomJS and not jsdom, both within a node.js context and standalone. May I suggest a comment in the documentation stating that getBBox is only available in PhantomJS as far as we know for now? Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants