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

make graphviz svg interactive #858

Merged
merged 2 commits into from
Feb 28, 2024
Merged

make graphviz svg interactive #858

merged 2 commits into from
Feb 28, 2024

Conversation

gertjanvanzwieten
Copy link
Contributor

No description provided.

@gertjanvanzwieten gertjanvanzwieten changed the title Graphviz make graphviz svg interactive Feb 27, 2024
nutils/_graph.py Show resolved Hide resolved
nutils/_graph.py Outdated Show resolved Hide resolved
nutils/_graph.py Outdated Show resolved Hide resolved
nutils/_graph.py Show resolved Hide resolved
nutils/_graph.py Show resolved Hide resolved
nutils/_graph.py Outdated Show resolved Hide resolved
@joostvanzwieten
Copy link
Member

Very nice!

@gertjanvanzwieten
Copy link
Contributor Author

Very nice!

What about the scale modification? (2nd commit)

@joostvanzwieten
Copy link
Member

Very nice!

What about the scale modification? (2nd commit)

Fine by me.

@gertjanvanzwieten
Copy link
Contributor Author

gertjanvanzwieten commented Feb 28, 2024

Very nice!

What about the scale modification? (2nd commit)

Fine by me.

Actually in the new version it's less ugly. Without onload I can insert the javascript near the bottom which is easier, and separate the scaling of width and height entirely (no longer confined to svg attributes, but it's probably ok) (edit: restored confinement to svg attributes)

nutils/_graph.py Outdated Show resolved Hide resolved
This patch inserts a javascript snippet into generated svg graphs to make nodes
and edges highlightable in capable viewers (such as a web browser).
This patch modifies the width and height parameters of the graphviz generated
svg image in order to scale it down to 2/3 the original size. This avoids
having to scale the image via the browser which may affect other tabs as well.
Sadly it does not seem possible to instruct the dot executable to generate an
image at the desired scale directly. The regular expression that is used
instead is fairly sensitive to the generated xml, but that is acceptable given
that the only risk is to leave the svg at its original scale.
@gertjanvanzwieten gertjanvanzwieten merged commit 59890da into master Feb 28, 2024
22 of 23 checks passed
@gertjanvanzwieten gertjanvanzwieten deleted the graphviz branch February 28, 2024 16:00
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

Successfully merging this pull request may close these issues.

2 participants