You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让PlantUML中Client类的注释保持原位置

PlantUML注释位置固定方案

当添加带原型的箭头后Client类的注释位置偏移,可通过明确指定注释位置强制固定在左侧:

方法1:直接指定注释位置

在定义注释时使用note left of语法,强制注释位于目标类左侧:

class Client {
    // 类成员
}
note left of Client: 你的注释内容
Client -[#blue,dashed]> ConcreteStrategy1 : 使用 <原型>

方法2:关联独立注释块

若注释是单独定义的块,可通过left of关联到Client左侧:

class Client
note as Note1: 你的注释内容
Note1 left of Client
Client -[#blue,dashed]> ConcreteStrategy1 : 使用 <原型>

以上两种方式都会让注释不受布局引擎调整影响,始终保持在Client类左侧。

内容的提问来源于stack exchange,提问作者Cody

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 21:30:05