1

Here is MCVE in PlantUML:

@startuml

'Define the components
[Main component] as c_main_component
[comp1] as c_comp1
[com2] as c_comp2
[comp3] as c_comp3
[comp4] as c_comp4

'Define the relationships
c_main_component -- c_comp3
c_main_component -- c_comp4

c_main_component - c_comp2
c_main_component - c_comp1

@enduml

The above results in the below image:

enter image description here

As one can see, comp3 and comp4 have a nice a diagonal lines connecting it to Main component from the bottom, just like expected. I want comp1 and comp2 have the same nice diagonal lines to connect to Main component from the right side. How can I do it?

The code as generated by PlantUML with the option -debugsvek:

digraph unix {
nodesep=0.486111;
ranksep=0.833333;
remincross=true;
searchsize=500;
sh0004->sh0006[arrowtail=none,arrowhead=none,minlen=0,color="#000011"];
sh0004->sh0005[arrowtail=none,arrowhead=none,minlen=0,color="#000015"];
sh0004 [shape=rect,label="",width=1.722222,height=0.522352,color="#000004"];
sh0005 [shape=rect,label="",width=0.861111,height=0.522352,color="#000005"];
sh0006 [shape=rect,label="",width=0.750000,height=0.522352,color="#000006"];
sh0007 [shape=rect,label="",width=0.861111,height=0.522352,color="#000007"];
sh0008 [shape=rect,label="",width=0.861111,height=0.522352,color="#000008"];
sh0004->sh0007[arrowtail=none,arrowhead=none,minlen=1,color="#000009"];
sh0004->sh0008[arrowtail=none,arrowhead=none,minlen=1,color="#00000D"];

}
Refael Sheinker
  • 713
  • 7
  • 20
  • 1
    The basic question here is actually how is it possible to define a 'docking point' i.e where the arrow between 'main component' and 'com2' should start. for this purpose I will add also the "dot" code I was able to retrieve from plantuml (option -debugsvek) to this question. – albert Jul 16 '18 at 10:57

2 Answers2

1

Why are you using for c_comp1 and comp2 a single dash ('-') and for c_comp3 and c_comp4 a double dash ('--')?

When using for all a double dash like:

@startuml
'Define the components
[Main component] as c_main_component
[comp1] as c_comp1
[com2] as c_comp2
[comp3] as c_comp3
[comp4] as c_comp4

'Define the relationships
c_main_component -- c_comp3
c_main_component -- c_comp4

c_main_component -- c_comp2
c_main_component -- c_comp1
@enduml

You will get a nicer image:

corrected image

albert
  • 8,285
  • 3
  • 19
  • 32
  • I want `comp1` and `comp2` have the same nice diagonal lines to connect to Main component from the *right side*, not from the bottom side. – Refael Sheinker Jul 15 '18 at 11:34
  • 1
    Clear to me, but I don't see a solution. I tried some things (with [hidde] and with left / right / up / down, maybe best to post also a question at http://forum.plantuml.net/questions – albert Jul 15 '18 at 12:51
1

I did some fiddling around and although I don't directly see it usable in this case I still think it might give some points to start. I found this article: How to force node position (x and y) in graphviz

Based on this I modified the resulting "debugsvek file" (cc_svek.dot) to (and made some coordinates a bit different for easier calculations by head and added some labels):

digraph unix {
nodesep=0.5;
ranksep=1;
remincross=true;
searchsize=500;
sh0004->sh0006[arrowtail=none,arrowhead=none,minlen=0,color="#000011"];
sh0004->sh0005[arrowtail=none,arrowhead=none,minlen=0,color="#000015"];
sh0004 [pos="1,-1!",shape=rect,label="4",width=1,height=0.5,color="#000004"];
sh0005 [pos="2,-0.75!",shape=rect,label="5",width=1,height=0.5,color="#000005"];
sh0006 [pos="2,-1.25!",shape=rect,label="6",width=1,height=0.5,color="#000006"];
sh0007 [pos="0,-2!",shape=rect,label="7",width=1,height=0.5,color="#000007"];
sh0008 [pos="1,-2!",shape=rect,label="8",width=1,height=0.5,color="#000008"];
sh0004->sh0007[arrowtail=none,arrowhead=none,minlen=1,color="#000009"];
sh0004->sh0008[arrowtail=none,arrowhead=none,minlen=1,color="#00000D"];

}

When using the command dot -K fdp -T png cc_svek.dot on it this results in the image:

enter image description here

albert
  • 8,285
  • 3
  • 19
  • 32