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

Preview outputs margin automatic fitting #572

Closed
sheymann opened this issue Mar 29, 2012 · 6 comments
Closed

Preview outputs margin automatic fitting #572

sheymann opened this issue Mar 29, 2012 · 6 comments
Assignees
Milestone

Comments

@sheymann
Copy link
Member

Following https://forum.gephi.org/viewtopic.php?t=1762&p=5996#p5996

Output in PDF/PNG/SVG should fit automatically, at least for the nodes.

@wumalbert
Copy link
Contributor

I observe that currently the margin is assign with a fixed value. This should be automatically determined so as to adapt to the graph size. In my opinion, we can assign the margin according to bounding box of the graph, for example 10 percent of the width of the bounding box.

@vijeshm
Copy link

vijeshm commented Apr 15, 2013

Yes, I've observed that as well. I used a slightly different approach suggested by wumalbert. If the user provides a margin that sufficiently contains the graph, the graph is exported as is. If the provided margin trims the graph, the approach will progressively increase the margin till it is completely contained. Apart from fitting the nodes, edges are fit.
PNG export before the fix:
Untitled_16_before
PNG export after the fix:
Untitled_16_after

The solution works if we have the rendered image in the form of a linearized pixels array. Unfortunately, I couldnt find anything equivalent to this structure in the case of PDF and SVG. Hence, I was not able to apply it in those cases. I've uploaded the code at vijeshm@628c995. Could anyone please verify the code and let me know if I could send a pull request?

@sheymann
Copy link
Member Author

Can you make a pull request directly so that I'll assign a reviewer?

@vijeshm
Copy link

vijeshm commented Apr 15, 2013

Sure. I'll do it right away.
Thanks.

@jersub
Copy link
Member

jersub commented Oct 2, 2015

Related to issue #239

@jersub jersub added this to the 0.9 milestone Nov 5, 2015
@jersub jersub self-assigned this Nov 5, 2015
mbastian added a commit that referenced this issue Dec 15, 2015
Compute the preview canvas size from the rendered elements, fixing #572
@jersub
Copy link
Member

jersub commented Dec 15, 2015

Automatic fitting is fixed except for labels, cf. #1218.

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

5 participants