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

Scale and Center Graph #195

Open
tuckergordon opened this issue May 27, 2021 · 3 comments
Open

Scale and Center Graph #195

tuckergordon opened this issue May 27, 2021 · 3 comments

Comments

@tuckergordon
Copy link

tuckergordon commented May 27, 2021

I've asked this question on Stackoverflow as well, but is there a way to scale and center a graph? I would like to display a graph that is 0.5 scale and centered within the SVG, but haven't found a good way of doing that.

Simple code snippit:

<div id="graph" style="width: 300px; height: 300px; border: 1px solid black"></div>
d3.select("#graph")
  .graphviz()
    .width(300)
    .height(300)
    .fit(true)
    .scale(.5)
    .renderDot('digraph {a -> b}');

This is somewhat related to #7 , but I didn't see an answer in there and figured it was worth bringing up since v2.2.0 came after that ticket was closed. Apologies if I should've continued the thread in that ticket instead of opening a new one

@magjac
Copy link
Owner

magjac commented Jun 2, 2021

I've now answered the SO post. I guess a simpler way would be if there was something built-in to d3-graphviz, but unfortunately there currently isn't.

@tuckergordon
Copy link
Author

Thank you! I'm very appreciative of your time on this! That was exactly what I was looking for.

Should I close out the issue, or leave it open for a possible future feature addition?

@magjac
Copy link
Owner

magjac commented Jun 3, 2021

If this is a feature that you would like to see, I think we should keep it open. I've added the "Enhancement" label to it.

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

No branches or pull requests

2 participants