PlantUML - 更好的箭头和文本排列方式

4

我正在尝试使用PlantUML绘制此组件图。

@startuml
skinparam linetype ortho
left to right direction

folder BASE {
    folder foo {
        component aaa
    }
    folder bar {
        component bbb
        folder ENV {
              artifact ccc <<config>>
              artifact ddd <<db>>
        }
    }

}

folder lorem {
    folder ipsum {
        component eee
        component fff
        component ggg
    }
    folder amet {
        component panel <<jar>>
    }
    folder dolor {
        artifact hhh <<config>>
    }
}

folder fox {
    folder jumps {
    artifact jjj <<document>>
    artifact kkk <<document>>
    artifact mmm<<document>>

    }
    folder lazy {
        artifact context.txt
    }
}

aaa --> context.txt : write
aaa --> bbb : launch
bbb --> hhh : read
bbb --> panel : launch
panel --> ccc : read
panel --> ddd : read

panel --> eee : run
panel --> fff : run
panel --> ggg : run

panel --> kkk : write
eee --> jjj : read
eee --> mmm: write

ggg --> jjj : write
ggg --> mmm: read

@enduml

结果有些混乱:箭头重叠,箭头上的文字难以阅读。
查看图片: enter image description here 是否有更好的方法来控制箭头和文本的位置? 例如,最小化箭头交叉并使文本更接近相应的箭头。
1个回答

1
当一个图表比较复杂时,让它更易读可能是一项不确定性的挑战。以下是一些建议:
  • 使用 skinparam ArrowThickness 3 来加粗箭头或者在箭头上的文本中使用粗体字。
  • 尝试使用 skinparam linetype polyline
  • 将名称放在箭头的起始或结束位置,例如使用 panel "run" --> eee(将名称放在起始位置)或 panel --> "run" eee(将名称放在结束位置),而不是使用 panel --> eee : run
  • together {...} 中组合两个包(就像一个隐藏的矩形,可以增加更多的空间)。
  • 切换 left to right direction 指令(带有注释)。
这里是应用于你的图表的一些方法,但还有改进的空间。
@startuml
skinparam linetype polyline
'left to right direction

skinparam Arrow {
    MessageAlignment left
    Thickness 3
    FontStyle Bold
    Color Blue
}

folder BASE {
    folder foo {
        component aaa
    }
    folder bar {
        component bbb
        folder ENV {
              artifact ccc <<config>>
              artifact ddd <<db>>
        }
    }

}

folder lorem {
    folder ipsum {
        component eee
        component fff
        component ggg
    }
    folder amet {
        component panel <<jar>>
    }
    folder dolor {
        artifact hhh <<config>>
    }
}

folder fox {
    folder jumps {
    artifact jjj <<document>>
    artifact kkk <<document>>
    artifact mmm<<document>>

    }
    folder lazy {
        artifact context.txt
    }
}

aaa --> "write" context.txt
aaa --> "launch" bbb 
bbb --> "read" hhh
bbb --> panel : launch
panel --> ccc : read
panel --> ddd : read

panel --> eee : run
panel --> fff : run
panel --> ggg : run

panel --> kkk : write
eee --> jjj : read
eee --> mmm: write

ggg --> jjj : write
ggg --> mmm: read
@enduml

Polyline and other hacks


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接