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

Permit users to customize Graphviz attributes through django settings #1429

Open
NyanKiyoshi opened this issue Oct 9, 2019 · 2 comments
Open

Comments

@NyanKiyoshi
Copy link
Contributor

NyanKiyoshi commented Oct 9, 2019

It would be useful to be able to customize the graph attributes using the django settings for more advanced controls (cf. http://www.graphviz.org/doc/info/attrs.html), some very general ones are for example size (size of the output height,width in inches), resolution in DPI for a better control over what one wants as output.

This is achievable by customizing this part of pygraphiz integration, like so:

  graph = pygraphviz.AGraph(dotdata)
  graph.layout(prog=kwargs['layout'])  # args="-Ln16"
+ graph.graph_attr.update(**any_custom_settings)
  graph.draw(kwargs['outputfile'])

For this, we could extend the current setting key GRAPH_MODELS.

We could also allow users to provide custom options per layout and general options for the drawing execution. It would be achievable like so:

graph.layout(prog=layout, args=options_for[layout])
graph.draw(..., args="-some -options")

This would also allow the users to use other layouts requiring additional arguments.

@trbs
Copy link
Member

trbs commented Oct 12, 2019

Seems like a really useful additional @NyanKiyoshi could you make a PR for this ?

@NyanKiyoshi
Copy link
Contributor Author

Sure! Will do whenever I have some spare time 👍

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