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

Allow UmlGraphDoc Doclet to generate non-scaling SVG #44

Open
robross0606 opened this issue Mar 17, 2017 · 10 comments
Open

Allow UmlGraphDoc Doclet to generate non-scaling SVG #44

robross0606 opened this issue Mar 17, 2017 · 10 comments

Comments

@robross0606
Copy link

When generating graphs in JavaDoc, the doclet automatically makes the graphs scale with the window. On large graphs, this renders them almost useless since the window cannot be scaled large enough to see anything. Is there an option to stop the SVG from scaling to the screen size and allow scrolling instead?

@dspinellis
Copy link
Owner

This cannot/should not be done at the level of UMLGraph. Instead, the corresponding page's CSS should adjusted accordingly.

@robross0606
Copy link
Author

It happens on EVERY page. Is there a specific CSS selector I can use to target every graph on every page of a package containing over 15,000 classes?

@robross0606
Copy link
Author

robross0606 commented Mar 17, 2017

With all due respect, if you're going to say it should be done in CSS then you should be doing it in CSS too. I took a look at the code and the height/width values are set:
<object width="100%" height="100%" type="image/svg+xml" data="AbstractApplicationModel.svg" alt="Package class diagram package AbstractApplicationModel" border="0"></object>
How does one override these values from CSS when they're specifically set on the Object? Not to mention that the object itself doesn't have a selector ID or class.

@dspinellis
Copy link
Owner

You're right. This is output generated by GraphViz, so there's not much that can be done in UMLGraph, right? Maybe try setting GraphViz options? For example, I get different output from GraphViz.

$ echo 'digraph {}' | dot -Tsvg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.36.0 (20140111.2315)
 -->
<!-- Title: %3 Pages: 1 -->
<svg width="8pt" height="8pt"
 viewBox="0.00 0.00 8.00 8.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 4)">
<title>%3</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-4 4,-4 4,4 -4,4"/>
</g>
</svg>

@robross0606
Copy link
Author

robross0606 commented Mar 17, 2017

I get same as you for the svg tag. The object tag is an outer element of what you just posted.

@robross0606
Copy link
Author

robross0606 commented Mar 17, 2017

I found in your code where you are specifically setting this. UmlGraphDoc.java line 165. Recommend changing:

private static final String UML_DIV_TAG = "<div align=\"center\">" + "<object width=\"100%%\" height=\"100%%\" type=\"image/svg+xml\" data=\"%1$s.svg\" alt=\"Package class diagram package %1$s\" border=0></object>" + "</div>";

to:

private static final String UML_DIV_TAG = "<div align=\"center\">" + "<object type=\"image/svg+xml\" data=\"%1$s.svg\" alt=\"Package class diagram package %1$s\" border=0></object>" + "</div>";

If you want it to be 100% then, as you said, this should be done in CSS with the selector div.uml > object. Ideally, this could be an additional command-line parameter. After all, if something easily done in CSS like -bgcolor is a command line parameter, then why not this?

@robross0606
Copy link
Author

robross0606 commented Mar 17, 2017

I have patched your code with a new -autosize doclet parameter. It defaults to true so existing functionality won't change. It does not yet address the use of CSS versus height and width usage. It does also fix a bug with your use of ! negated boolean parameters since they wouldn't match the valid option check. Let me know if/how you want to proceed.

@dspinellis
Copy link
Owner

This is great, thank you! Would you like to contribute two pull requests? One for the new feature (also please add a line in the documentation and usage info) and one on the fixed bug?

@robross0606
Copy link
Author

One pull request is fine with me as long as it is fine with you since it is intermingled in the same file. I did add a line in the documentation and usage info, but didn't add anything to the version documentation.

@dspinellis
Copy link
Owner

OK, let's do it like that.

@dspinellis dspinellis reopened this Mar 18, 2017
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

No branches or pull requests

2 participants