is it possible to make a single object wider/longer in my component diagram

0 votes
asked Oct 30, 2019 in Closed feature request by mc365
My diagram has a component with multiple incoming and outgoing arrows. I think it would look better if the component were longer than the others.

1 Answer

0 votes
answered Dec 22, 2021 by Martin (8,360 points)

Plantuml sizes a component based on its contents, there is no way to specify size (so the following are clumsy workarounds).

Normally I would do this by including trailing spaces to increase width and blank lines to increase height.  Using a monospaced font makes width easier to control (but more granular). (See for ideas to wrap this in a simple macro).

component A [
<font:monospace>            </font>
<font:monospace>            </font>
<font:monospace>            </font>
<font:monospace>            </font>

And here is a bonus idea using raw Graphviz contents to specify a height and width numerically.  I'm not sure whether it is worth the deviation from Plantuml syntax - probably not.  It would need manual adjustment to fit non-default themes.

component Z [
digraph G {
graph [pad=0]
n [fillcolor=lemonchiffon style=filled margin=0 height=0.4 width=6 shape=plaintext fontname="SansSerif" fontsize=11 label="Some text goes here"]

(click diagram for online server)