Howdy,
I'd like my draw.io diagrams to scale relative to window size much like inserted images scale if I set relative width for them.
Does anyone know if it's possible to implement?
For example, I can configure a 98 percent scaling for inserted images by setting width attribute, like so:
<p>
<ac:image ac:align="center" ac:border="true" ac:width="98%">
<ri:attachment ri:filename="image.jpg"/>
</ac:image>
</p>
This allows the image to scale if my users change the width of browser window or drag the hierarchy sidebar.
However, for a draw.io diagram I can only set fixed size properties:
<p style="text-align: center;">
<ac:structured-macro ac:macro-id="dbfae15b-0814-495f-9a34-c408f39ab113" ac:name="drawio" ac:schema-version="1">
<ac:parameter ac:name="border">true</ac:parameter>
<ac:parameter ac:name="viewerToolbar">true</ac:parameter>
<ac:parameter ac:name="fitWindow">false</ac:parameter>
<ac:parameter ac:name="diagramName">Some diagram</ac:parameter>
<ac:parameter ac:name="simpleViewer">false</ac:parameter>
<ac:parameter ac:name="width">600</ac:parameter>
<ac:parameter ac:name="links">auto</ac:parameter>
<ac:parameter ac:name="tbstyle">top</ac:parameter>
<ac:parameter ac:name="diagramDisplayName"/>
<ac:parameter ac:name="lbox">true</ac:parameter>
<ac:parameter ac:name="diagramWidth">2197</ac:parameter>
<ac:parameter ac:name="revision">2</ac:parameter>
<ac:parameter ac:name=""/>
</ac:structured-macro>
</p>
This has a major flaw: the draw.io diagram doesn't scale to resizing. If you drag the sidebar, diagram would not rescale. Instead, browser would draw scrollbars.
Is there any way to force fluent rescaling for diagrams?
Thank you.
Okay then. I seem to have to found the solution.
To let the draw.io diagram scale to the resized browser window, do the following:
1. Turn off draw.io toolbar and set scaling factor. That's the toolbar that pops up when you hover the pointer over the diagram. This will allow the browser to scale to the width or height of the PNG image that lays over the diagram. Otherwise, browser attempts to scale to the size of this toolbar.
2. Set relative percentage for the diagram. This will actually enable resizing of the layered diagram image.
Turning off draw.io toolbar and setting scaling factor
Setting relative percentage for the diagram
To complete this, you will need Confluence Source Editor macro.
When you complete these steps, your draw.io diagrams will scale to the resized browser window.
Drawback
The only drawback I have found: canvas. It seems that whenever there is draw.io toolbar enabled, macro automatically cuts out extra parts of diagram canvas to that unused white canvas does not draw on the page.
However, when you turn toolbar off, you disable this automatic cut off. If your diagram is not high enough to fill the standard canvas drawn by draw.io macro, you will see a significant white space after the diagram after you disable showing of the toolbar. As an effect, if a new heading follows the diagram, it will look as if you have added extra space before the heading, which kind of messes up the whole picture. Not really cool, but, I am hoping for a better future. Love the macro.
Is this on cloud or server?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.