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

[ERD] The size of horizontal lines is not modified according to the number of characters #874

Open
claudio-salvio opened this issue Jan 22, 2022 · 3 comments

Comments

@claudio-salvio
Copy link

In entity-relationship diagrams, the size of horizontal lines is not modified according to the number of characters (e.g. dots) placed on the line.

@startuml "ERD, horizontal arrows failed sizing example"

<style>
header {
    HorizontalAlignment center
    }
</style>

header "ERD, horizontal arrows failed sizing example"
hide circle

entity "Entity1" as e1 {}
entity "Entity2" as e2 {}
entity "Entity3" as e3 {}
entity "Entity4" as e4 {}

e1 "e1 e2 " }o.right.o{ "e2 e1 " e2
e2 "e2 e3 " }o..right.o{ "e3 e2 " e3
e3 "e3 e4 " }o..right..o{ "e4 e3 " e4

@enduml

image

It would be very useful if horizontal lines behaved like vertical lines.
In vertical lines, the length is modified in relation to the number of characters placed on the line.

@startuml "ERD, vertical arrow size variation: example"

<style>
header {
    HorizontalAlignment center
    }
</style>

header "ERD, vertical arrow size variation: example"
hide circle

entity "Entity1" as e1 {}
entity "Entity2" as e2 {}
entity "Entity3" as e3 {}
entity "Entity4" as e4 {}

e1 "e1 e2 " }o.down.o{ "e2 e1 " e2
e2 "e2 e3 " }o..down.o{ "e3 e2 " e3
e3 "e3 e4 " }o..down..o{ "e4 e3 " e4

@enduml

image

I suspect that this situation is repeated in class diagrams, since ERDs are a specialization of those.

I would like to take this opportunity to thank all those who contribute with their effort to make PlantUML possible. 👏

Greetings,
Claudio

TIP: To toggle the display between code and image of PlantUML diagrams contained in web pages accessed from browsers, I have found the "Markdown Diagrams" extension very useful.
It is available -at least- for Firefox, Chrome and Edge.

@The-Lum
Copy link
Collaborator

The-Lum commented Jan 22, 2022

Hello @claudio-salvio,

If all are on the same direction...
A possible workaround is to use:

left to right direction

As:

@startuml
left to right direction
<style>
header {
    HorizontalAlignment center
    }
</style>

header "ERD, vertical arrow size variation: example"
hide circle

entity "Entity1" as e1 {}
entity "Entity2" as e2 {}
entity "Entity3" as e3 {}
entity "Entity4" as e4 {}

e1 "e1 e2 " }o.down.o{ "e2 e1 " e2
e2 "e2 e3 " }o..down.o{ "e3 e2 " e3
e3 "e3 e4 " }o..down..o{ "e4 e3 " e4
@enduml

If that can help,
Regards.

@claudio-salvio
Copy link
Author

claudio-salvio commented Jan 22, 2022

Hello @The-Lum

Thanks for your suggestion.

Unfortunately it doesn't work for me because the class diagrams and ERDs that I usually use have both vertical and horizontal display.

However, when I saw your proposal I remembered that I had once seen something similar while I was building a chart.
It happened to me when I inadvertently placed left to right direction on a chart that had only one section with lines using .down..

It is important to note that for left to right direction to work it is necessary to replace .right. with .down., as you did.

As seen below, the horizontal layout example I gave in my original post also looks wrong (in two ways) if you only enter left to right direction but do not replace .right. with .down..

@startuml (%filename())
''title %substr( %filename(), 0, ( %strpos( %filename(), "." ) ) )

hide circle
left to right direction
<style>
header {
    HorizontalAlignment center
    }
</style>

entity "Entity1" as e1 {}
entity "Entity2" as e2 {}
entity "Entity3" as e3 {}
entity "Entity4" as e4 {}

e1 "e1 e2 " }o.right.o{ "e2 e1 " e2
e2 "e2 e3 " }o..right.o{ "e3 e2 " e3
e3 "e3 e4 " }o..right..o{ "e4 e3 " e4

footer output generated date: %date("yyyy.MM.dd' at 'HH:mm")
@enduml

image

Replacing .right. with .down. in a layout eminently horizontal doesn't seem to make much sense.
But, beyond this, the fact seems to indicate that something must occur in the source code in the presence of .down. that does not occur when .right. is used.
Perhaps this is a sign that it can be resolved quickly. 🙂

I hope you enjoy your weekend,
Claudio

@claudio-salvio
Copy link
Author

Hello

I found a workaround for the horizontal line sizing problem.
It consists in the use of skinparam nodesep.

Beyond this, it would be desirable to fix the bug so that the horizontal lines behave like the vertical ones when varying the number of characters used to define them.

@startuml "ERD, horizontal arrows failed sizing example 'fixed' with skinparam nodesep"

hide circle
skinparam nodesep 150
<style>
header {
    HorizontalAlignment center
    }
</style>

entity "Entity1" as e1 {}
entity "Entity2" as e2 {}
entity "Entity3" as e3 {}
entity "Entity4" as e4 {}

e1 "e1 e2 " }o.right.o{ "e2 e1 " e2
e2 "e2 e3 " }o..right.o{ "e3 e2 " e3
e3 "e3 e4 " }o..right..o{ "e4 e3 " e4

footer output generated date: %date("yyyy.MM.dd' at 'HH:mm")
@enduml

ERD, horizontal arrows failed sizing example 'fixed' with skinparam nodesep puml

Greetings,
Claudio

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