如何用plantuml绘制互连表

发布于 2025-02-11 03:39:16 字数 1300 浏览 0 评论 0原文

我尝试用plantuml绘制互连的表(不是eentities!)。不幸的是,我找不到任何命名表的可能性。我唯一可以使用的解决方案是将其定义在另一个组件中,例如。一个对象,能够在它们之间建立互连。

@startuml

object Organization {
  <#lightblue,#black>|=  organizationNo  |=  name  |=  address  |
  <#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |
  <#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |
  <#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |
}


object OrgCust {
  <#lightblue,#black>|= organizationNo  |=  customerNo  |
  <#white>|  OS07  |  CM67  |
  <#white>|  OS7  |  CM67  |
  <#white>|  OC11  |  CH11  |
}

object Customer {
  <#lightblue,#black>|=  customerNo  |=  fName  |=  lName  |=  creditLimit  |
  <#white>|  CJ13  |  John  |  Jeschke  |  5000  |
  <#white>|  CK37  |  Nina  |  Knabel  |  2000  |
  <#white>|  CM67  |  Felix  |  Magee  |  1300  |
  <#white>|  CH11  |  Lilla  |  Hopka  |  3000  |
}

Organization -[hidden]-> OrgCust
OrgCust -[hidden]-> Customer

Organization ||--o{ OrgCust
Customer ||--o{ OrgCust

@enduml

看起来还不错,但是额外的框架有些打扰我。有可能避免这些帧并直接连接表(但也许仍然有标题的表格)?

I try to draw interconnected tables (not Eentities!) with PlantUml. Unfortunately, I could not find any possibility to name a table. The only solution I could use is to define it in another component, eg. an object, to be able to make interconnections between them.

@startuml

object Organization {
  <#lightblue,#black>|=  organizationNo  |=  name  |=  address  |
  <#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |
  <#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |
  <#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |
}


object OrgCust {
  <#lightblue,#black>|= organizationNo  |=  customerNo  |
  <#white>|  OS07  |  CM67  |
  <#white>|  OS7  |  CM67  |
  <#white>|  OC11  |  CH11  |
}

object Customer {
  <#lightblue,#black>|=  customerNo  |=  fName  |=  lName  |=  creditLimit  |
  <#white>|  CJ13  |  John  |  Jeschke  |  5000  |
  <#white>|  CK37  |  Nina  |  Knabel  |  2000  |
  <#white>|  CM67  |  Felix  |  Magee  |  1300  |
  <#white>|  CH11  |  Lilla  |  Hopka  |  3000  |
}

Organization -[hidden]-> OrgCust
OrgCust -[hidden]-> Customer

Organization ||--o{ OrgCust
Customer ||--o{ OrgCust

@enduml

It looks not that bad, but the extra frames disturb me a bit. Would be possible to avoid these frames and connect the tables directly (but maybe still have a caption for the tables)?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘寄 2025-02-18 03:39:16

您可以尝试将它们绘制为注释(不幸的是,克里奥尔语法在矩形或软件包元素中不起作用)。 You have to hide the note outline and background:

@startuml

<style>
note {
    backgroundcolor white
    shadowing 0
    linecolor transparent
}
</style>

note as Organization 
  <#lightblue,#black>|=  organizationNo  |=  name  |=  address  |
  <#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |
  <#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |
  <#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |
end note

note as OrgCust
  <#lightblue,#black>|= organizationNo  |=  customerNo  |
  <#white>|  OS07  |  CM67  |
  <#white>|  OS7  |  CM67  |
  <#white>|  OC11  |  CH11  |
end note

note as Customer
  <#lightblue,#black>|=  customerNo  |=  fName  |=  lName  |=  creditLimit  |
  <#white>|  CJ13  |  John  |  Jeschke  |  5000  |
  <#white>|  CK37  |  Nina  |  Knabel  |  2000  |
  <#white>|  CM67  |  Felix  |  Magee  |  1300  |
  <#white>|  CH11  |  Lilla  |  Hopka  |  3000  |
end note

Organization -[hidden]-> OrgCust
OrgCust -[hidden]-> Customer

Organization ||--o{ OrgCust
Customer ||--o{ OrgCust

@enduml

“

要获得表格的标题,您可以在桌子上格式化它吗?或在注释(开始或结束)内的一行中添加&lt; b&gt;/b&gt;吗?

EDIT

I also discovered that you can embed the table in the name of a class, such as:

@startuml
<style>
class {
    BackgroundColor transparent
    linecolor transparent
}
</style>

hide empty members
hide circle
class "<#lightblue,#black>|=  organizationNo  |=  name  |=  address  |\n\
<#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |\n\
<#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |\n\
<#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |" as Organization {
}
@enduml

enter image description here

You can try to draw them as notes (the Creole syntax doesn't work in Rectangle or Package elements unfortunately). You have to hide the note outline and background:

@startuml

<style>
note {
    backgroundcolor white
    shadowing 0
    linecolor transparent
}
</style>

note as Organization 
  <#lightblue,#black>|=  organizationNo  |=  name  |=  address  |
  <#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |
  <#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |
  <#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |
end note

note as OrgCust
  <#lightblue,#black>|= organizationNo  |=  customerNo  |
  <#white>|  OS07  |  CM67  |
  <#white>|  OS7  |  CM67  |
  <#white>|  OC11  |  CH11  |
end note

note as Customer
  <#lightblue,#black>|=  customerNo  |=  fName  |=  lName  |=  creditLimit  |
  <#white>|  CJ13  |  John  |  Jeschke  |  5000  |
  <#white>|  CK37  |  Nina  |  Knabel  |  2000  |
  <#white>|  CM67  |  Felix  |  Magee  |  1300  |
  <#white>|  CH11  |  Lilla  |  Hopka  |  3000  |
end note

Organization -[hidden]-> OrgCust
OrgCust -[hidden]-> Customer

Organization ||--o{ OrgCust
Customer ||--o{ OrgCust

@enduml

PlantUML Diagram

To get a caption for the tables, you could format it in the table somehow? Or add <b>Caption here</b> on a line inside the note (beginning or end)?

EDIT

I also discovered that you can embed the table in the name of a class, such as:

@startuml
<style>
class {
    BackgroundColor transparent
    linecolor transparent
}
</style>

hide empty members
hide circle
class "<#lightblue,#black>|=  organizationNo  |=  name  |=  address  |\n\
<#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |\n\
<#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |\n\
<#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |" as Organization {
}
@enduml

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文