-
Notifications
You must be signed in to change notification settings - Fork 37
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
Conversion fails in SVG.py due to <image> #45
Comments
Example .dot text included to assist troubleshooting This .dot file was generated using the Python Diagrams module, using the following Python code;
|
Ouch, got the same here; reduced testcase causes the same crash: strict digraph CDD {
splines="true"
labelloc="t"
label="CDD"
// sep=.5
Hello [label="/aa/bb\nHello"]
World [shape=box, color=blue, fontcolor=blue, tooltip=aaaa]
Hello -> { World }
} Removing the tooltip attribute makes the conversion work |
@hbmartin could you possibly take a look into this for us? Much love and thanks!! |
just came across this really interesting repo -> @hbmartin THANK YOU for sharing! @markthompson94 : i'll probably try to fix this over the weekend if it's still not working and get back to you. |
The SVG file produced by graphviz via the Diagram lib (using the python code you provided) looks something like: ...
<!-- 1st g tag -->
<g id="edge3" class="edge">
<title>94a1a24258c54e028e3b9cb0054dadc9->739289249c574bffb2ed3d49b021b1da</title>
<path fill="none" stroke="#7b8894" d="M338.5,-406.81C338.5,-406.81 338.5,-363.22 338.5,-363.22"/>
<!-- this has a polygon tag -->
<polygon fill="#7b8894" stroke="#7b8894" points="342,-363.22 338.5,-353.22 335,-363.22 342,-363.22"/>
</g>
...
<!-- 2nd g tag -->
<g id="node5" class="node">
<title>2c1229f79a9141eea4b8ef297492ec26</title>
<image xlink:href="does-not-matter/.local/lib/python3.8/site-packages/resources/aws/compute/ec2.png" width="101px" height="101px" preserveAspectRatio="xMinYMin meet" x="432" y="-335"/>
<text text-anchor="middle" x="482.5" y="-219.6" font-family="Sans-Serif" font-size="13.00" fill="#2d3436">worker4</text>
<!-- this does NOT hava a polygon tag -->
</g>
... As we can see above, the 1st Conclusion (might be wrong, I had just a quick look):The problem is that this lib needs to have EITHER a @hbmartin Could you please just confirm -> yes/no? 😄 graphviz2drawio/graphviz2drawio/mx/NodeFactory.py Lines 55 to 60 in 7519935
|
@hbmartin would you possibly be able to take a look at this? It'd be fantastic to have the ability to integrate Custom nodes from Python Diagrams in the graphviz2drawio module |
Was anyone able to workaround this issue? |
Think we need @hbmartin to help us out there 🤞 |
Hi @hbmartin, when you have any time would you be able to look into this at all? thanks so much!! |
Instead of looking only at direct childs of a node, search the complete tree starting at the node. This is particularly useful when we add fancy attributes, since they tend to add encompassing groups to the graph. It is pretty easy to test for the bug and how it can be reproduced. It's tracked in: hbmartin#45 I re-created a minimal fail case from hbmartin#45 (comment) ``` digraph { Pitas Pizza [ tooltip=Delicious ] Pitas -> Pizza } ``` Previous HEAD failed to parse this.
Instead of looking only at direct childs of a node, search the complete tree starting at the node. This is particularly useful when we add fancy attributes, since they tend to add encompassing groups to the graph. It is pretty easy to test for the bug and how it can be reproduced. It's tracked in: hbmartin#45 I re-created a minimal fail case from hbmartin#45 (comment) ``` digraph { Pitas Pizza [ tooltip=Delicious ] Pitas -> Pizza } ``` Previous HEAD failed to parse this.
Instead of looking only at direct childs of a node, search the complete tree starting at the node. This is particularly useful when we add fancy attributes, since they tend to add encompassing groups to the graph. It is pretty easy to test for the bug and how it can be reproduced. It's tracked in: hbmartin#45 I re-created a minimal fail case from hbmartin#45 (comment) ``` digraph { Pitas Pizza [ tooltip=Delicious ] Pitas -> Pizza } ``` Previous HEAD failed to parse this.
@markthompson94 @fabiomurillo @ams1 I came across the repo for the same reason as you guys, wanted to render my diagrams file into drawio. I did resolve the svg issue after hacking around the library files a bit. (The solution is too long to share here). But even if you solve the svg render issue the edge placement is very poor and the actual XML generated is not satisfactory by any means. I have created a script which does a better conversion into drawio SOLELY for diagrams library code. I know its 2 years too late but im putting it out there for anyone who had this issue like me. |
Work has started on this in #49 and is slated for 0.4 release! |
The text was updated successfully, but these errors were encountered: